0
Why does'nt my script work in unity? Trying to spawn on same location textureOrg.transform.position=Oplayer.transform.position;
8 Réponses
+ 2
Can I see the entire script somehow? Maybe via picture or copy paste all the code onto here? (Assuming my previous post didn't solve the problem)
Just make sure some object has the script attached to it.
+ 1
Looks fine to me.
What is the error or warning message you are receiving?
+ 1
The scripts only run automatically if it is attached to an object (as its component).
The method:
void Start()
Will automatically be called once when loading.
void Update()
Will automatically be called every frame.
+ 1
Then you have to call it somehow.
Start() and Update() are similar to the 'main' method you see in code playground. Creating a method on your own won't be automatically called.
void Start(){
myMethodName();
// go to method
}
void myMethodName(){
x.transform.position = ....;
}
+ 1
^ Good tip lol. I spent over an hour trying to make my high Score list work going crazy. After all that time I realized I never attached the script to an object in my scene
0
the thing is my player object wont spawn on or even near the other. I also have trouble with other codes not working. I am starting to think that my unity has problems loading the scripts or something.
0
I used this script inside a void I created but it still wont load
0
Btw i did not get any errors either