Changing an object's name

How can I change an object’s name with javascript coding? Thank you! :slight_smile:

ReferenceToGameObject.name = “New Name”;

Or just name = if this is accessing the gameobject the script is attached to.

Every object has a name attribute, it’s in the docs.

Unsurprisingly, Object.name is the first result when you use the search function.

Thanks alot Dman!!

Jravey, i was actually searching “gameobject” in which you will find it does not exist.

Thanks guys

Sorry, my mistake, it does exist in gameobject, under inherited members… inherited from objects i presume? Anyway, thanks. :slight_smile:

Correct, GameObject extends Object.