- Home /
Question by
Carnifex12 · Dec 08, 2014 at 10:09 PM ·
gameobjectstringconvert
Convert game object to string?
I have an object and a string :
public var mainName : String = "John";
public var name = "";
I want to set the string "name" to what "mainName" is, in this case "John".
function Start () {
name = mainName;
}
But that gives me this error:
BCE0031: Language feature not implemented: Ambiguous(story.name, UnityEngine.Object.name).
I'm using Javascript, and the name of my script is "story". How can I do this?
Comment
Best Answer
Answer by tanoshimi · Dec 08, 2014 at 10:10 PM
Objects already have "names", so call your variable something different. And please assign it a type as well.
public var mainName : String = "John";
public var myName : String = "";
function Start () {
myName = mainName;
}
Your answer
