Monday, June 16, 2014
Simple Platformer Day 08
Do NOT attach GUI as a child or component to... everything else, because its position works differently than... everything else.
Forumer's post that helped me discover this mistake:
"Please do what I said and make the GUIText a separate object. It should not be a child of the camera, it should not be a component on the camera. It must be a totally separate independent object because it uses viewport space, not world space. It works 100% correctly: GameObject > Create Other > GUIText. Do not move it away from the 0..1 range in x/y or it won't be visible."
Created a separate script for GUI.
gameObject.guiText.text = "Score:" + GM_Cs.theScore;
How position works: 0.5, 0.9 would be "upper middle of the screen".
noted for later use, changing something's position in script:
gameObject (or score.gameObject) .transform.position