Novice here - of course. I'm using Unity 5, and am looking to display on screen the coordinates of a player using a FPS camera. The main reason is I'm using a camera path animator to fly around a terrain scene I built for class, and think by logging coordinates via walking around in FP will make placing my camera path waypoints a lot easier.
What I have done:
-Created new empty game object -Added Component -> Rendering -> GUIText -Added Component -> New Script ->C#
Now I of course searched around to find a solution and found this:
function OnGUI () {
GUI.Label (Rect (10,120,500,100), "X = " + transform.position.x + " Y= " + transform.position.y + "Z= " + transform.position.z);
}
Which is great! But I am not a strong C# programmer by any means, but I do know this needs a Player variable of some sort yet. So please, could anyone simply direct me, or mind posting the code needed to make player coordinates appear on the screen. This doesn't have to be pretty or anything, I just need to write down the data as I walk around in FP. (unless you want brownie points and know of a way to log coordinates into a .txt file on button press... hahaha Thanks guys!
I'm not sure this is what you want....
Create new GameObject(GUIText) and make it's parent with your player game object. Now GUIText game object will follow your player object automatically
Add new script(i.e, PlayerPositionLogger.cs). to GUIText game object.
Find player script on void Start()
on PlayerPositionLogger.cs or declare public Player player;
and link player object on editor.
Update content of GUIText with player object.