Hi I just want to change and display some variables in my player class.
Here is my player class:
public class SpielerController : MonoBehaviour {
public int SpielerPunktzahl;
public string SpielerName;
// Use this for initialization
void Start () {
this.SpielerPunktzahl = 24;
}
// Update is called once per frame
void Update () {
}
}
The GameObject is called “Player1” where this script is attached.
Now I’m trying to get access to these two variables from another GameObjact called “GameGUI”. How can i get access from within the script attached to the GameGUI object?
Would be nice if you could help me to solve this problem. I have searched a lot and tried a lot examples from the internet, but nothing worked.
Thaks a lot
This link does not work anymore. [Accessing Other Game Objects.][1] [1]: http://docs-jp.unity3d.com/Documentation/ScriptReference/index.Accessing_Other_Game_Objects.html
– V4mpyHere's a very good answer on [accessing variables from other GameObjects][1] [1]: http://answers.unity3d.com/questions/11527/how-do-i-access-information-eg-variables-functions.html
– Jamora