How do I get individual position co-ordinates in another function? In JavaScript it was as simple as passing something like player.transform.position and you could access the X co-ord with just .x appended to whatever name you gave your object. Tried that in C# and all I got for Xmas was a big fat error.
My code is:
At the other end I have:Code:string type = "warning"; string log = "Test string"; object location = player.transform.position;EventLogger?.Call("AppendToLog", type, log, location);
This works, in thst it returns the full co-ords, but I want the individual co-ords rather than the formatted ones.Code:void AppendToLog(string type, string log, object location) { Int32 NowTimestamp = GetTimestamp(); Puts("AppendToLog says: " + type + " | " + log + " | " + location + " | " + NowTimestamp);}
Thanks in advance,
T.
Accessing position properties in C#?
Discussion in 'Rust Development' started by Rebajas, Dec 18, 2016.