Does anybody know how to modify a static variable from a different script in Unity?
Asked
Active
Viewed 1,079 times
-7
-
3Classname(dot)Staticvariable = Value; – Max Jul 20 '15 at 12:30
1 Answers
-1
Please, provide more information about how are you trying to do this...
If you need to change between mono behaviours, for example, you will need to get current instance of behaviour you like to change in a way like
myGameObjectInstance.GetComponent<MyBehaviourWithStatic>().myStatic = value;
but note that user2320445 answer is not wrong, it depends on your context. Be more specific on your question and we could provide better and precise answers

Frohlich
- 953
- 7
- 17