Using a var from another script with using static?

Using a var from another script without using static?

Hi how do yo access another variable from a script that is attached to a different game object without using a static variable???

Thanks.

  1. find the game object that the script is attached to using say var myGameObject = Gameobject.find(“Zombie”)
  2. Then do var here = myGameObject.getComponent(THENAMEOFYOURSCRIPTHERE).myVar
    Do make sure your myVar is a public variable. You can also access public function this way.
    look here for more information Unity - Scripting API: GameObject.GetComponent