-7

Does anybody know how to modify a static variable from a different script in Unity?

Sayse
  • 42,633
  • 14
  • 77
  • 146
DubGamer87
  • 143
  • 2
  • 11

1 Answers1

-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