Noob here just simple question how do I convert gameobject to string variable? Thanks in advance
Do you mean a name of a GameObject? Cause then it’s:
var goName : String = gameObject.name;
If you mean something else, remember that you have the ToString() function.
Based on your question, it would appear that you have little to no programming experience. In order to convert your object to a string (through the most common method), you need to implement the ToString()
function in a script attached to your game object. Of course, this requires you to call that function on the script itself, as calling GameObject.ToString()
won’t call your implementation.
Of course, I have no idea what you want specifically to be in that string. If you only want the object’s name, save had the right idea: use gameObject.name
.