Hi, I am making a rts game. I can add objects and each costs resources . I have 3 buildings and each have theirs own resources but i want a single place were they can get resources.
Can you help me ?
Cheers!
Else say i want to import a variable from a script in other script.
In all cases :
- Get the component : GetComponent (ScriptName)
- Get the variable : variable
If Scripname variable is static (global)
- ScriptName.variable
Else (ScriptName variable is not static)
- Get the object with ScriptName : GameObject.Find (“ObjectName”)
- And from it, ScriptName.variable, so you have GameObject.Find (“ObjectName”).ScriptName.variable
I don’t think I get it…