I am new in unity3d,
I put different script in every gameobject,
the game run ok,
but when i need finish it,
i found a problem,
i don’t know how to link all script together,
so i decide to write in a empty object and link all the script together,
but i dun know how get all script in a script,
any help?
It’s very messy to put all your scripts in one script. Scripts are better organized by keeping them on the object that they deal with. To reference another script from a script you use GetComponent. It’s common to have a game manager script on an empty object. This keeps track of things like Menu system, changing scenes, etc.
Hi Dzxyan, I put together a small package that demonstrates scene transitions that might be helpful.
You can grab it here: Scene Transitions
-Raiden
Dzxyan I see we have similar problem :). Like fire7side wrote “It’s very messy to put all your scripts in one script”, hovewer I’ve problem how to use this GetComponent which I described here http://forum.unity3d.com/threads/204336-C-get-variable-from-another-script. I know I miss something easy but what ?
Thanks all reply,
i got one solution for it,
i using broadcast function to call the script,
it will link all script together and make my script become not so messy.
If you need to access a basic game controller from any script, I would suggest using Unity’s tag system. Create a custom tag, and assign it to the game controller object. Any game object in your scene will then be able to access that object, and the script attached to it by referencing it’s tag.