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?

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;
}