- Home /
Showing information of incoming gameobject
Hi guys,
I'm new to Unity, now Im plan to build a space game where my spaceship will always driving forward and shooting incoming asteroids.
example game: http://www.matteley.co.uk/labs/unity3d-spacerunner/
The problem now is I need to display GUIText AND crosshair on infront of incoming asteroids that will move along (x,y,NOT Z) with them? I know that this can be done by using WorldToViewportPoint.
Should I separate the labels from asteroid gameobjects or combine both of them? How can it be done?
thanks.
Answer by flamy · Feb 10, 2012 at 09:55 AM
you have to seperate it, because if it is a child of some object, the transform.position of parent would also be added to the gui.text's transform.position and would give a unexpected output(depending upon parent's position),
but the best way would be drawing it using GUI.Label function!! with WorldToScreenPoint function...this would make it organized
Your answer
Follow this Question
Related Questions
Crosshair? How? 6 Answers
asteroids make framerate dip after too many have been created 1 Answer
Box Collider bounce causing rigidbody to change rotation -1 Answers
GUIText Instantiation to show at Asteroid position 0 Answers
Random generation of Asteroids 3 Answers