- Home /
wanting instance a variable of other script file??
Hello guys,
i've some script. and ai wanna instance some variable of other script.
i've a game controller with a script called 'gamecontroller.cs
and i've too a prefab called asteroid with has a script called mover.cs
i want instance a variable called 'speed' at mover.cs in gamecontroller.cs
i did someting like:
public Mover mover
and try call mover.speed. but doesn't work. someone could help me :(
Answer by KevinCodes4Food · Jan 18, 2014 at 08:51 PM
Be sure the speed variable on Mover is public as well, or has appropriate getter/setter methods.
If you would to be able to access it without creating a Mover instance, make it static.
its a public variable. but i don't know about this getter and setter. have u some exemple for me please?
Your answer
Follow this Question
Related Questions
multiple shaders per shader file 2 Answers
how do you interpret error logs? 1 Answer
Adding a ui text as a child of canvas disables all child buttons and makes them break 1 Answer
W Hotkey Bugged 0 Answers
Fatal Error Failed to Load Mono 2 Answers