- Home /
passing public values between objects
I have two game objects. One detects and counts collisions and responds to player action and movement. The other is a simple GUIText object that I want to display the collision counts from the player object. Both have public values for the counts and respond properly if each is tested (Counts accumulate in the player script, I can display values from the GUIText script. How do I pass the values from the player object to the GUIText object? Thanks, Old John
Comment
Create a public reference in your script on player
public GUIText myGuiText;
drag/drop the gameobject with the GUIText into that in the inspector
myGuiText.text = someCollisionCount.ToString();
I don't use GUIText but I think that'll work