Can the objects name be chenged while in game?

Hey there Blenderers,

In my project I add objects while the game is running.
When doing so I end up with several objects with the same name, but I need them to have unique names.
Therefore I tried to change the names.
But when I use something like: = ‘somename’

I get an error; the name is read-only.

Is there a way to change the name of the objects I use anyway?

Greetings to you


no, the name is read-only.

There are similar threads you can search, basically you can store objects you add in other objects now or in scenes so you should do this rather then use names, (its faster too).

Ideasman42, Unless you want to explain yourself a little better, could just allow us to change an object’s name? please?

Use your own name variable: ob[‘name’] = “myname”

Or use a dictionary. Every time you add an object:

mydict[‘uniquename’] = myob

Then later you can call the object with


Thank you all for your replies

I gues the answer to my question is a simple ‘no’; however I fail to see why the name atribute is read-only.

I do not quite understand what you mean

I apreceate the work-arounds you sugguest I think I will use the second one

Thanks again


The ability to change names would introduce all sorts of other checks and balances that have to be looked at. If you have an object’s name in an Add Object actuator, but then change the name, the Add Object actuator probably won’t know what to do. What happens if you try and set the name of an object to a name that already exists? It’s not as simple as you’re seeing it… it’s not just changing a string value.

What reasons would you have for needing to change it? I can’t think of one that isn’t better handled by something else.


You are right ofcourse; you should be very carefull when changing names of objects.
I use the addobject-actuator to add objects to my scene and by doing so I end up with a lot of objects with the same name.
I need to handle them one by one. In my (maybe shortsighted) opinion it would be most simple to get to their data by calling them by their unique name, rather then access them through a dictionary.
But okay so be it
No offence ment to annyone. I just wondered if I could change the names.

Greetings to you all


You can access an object on your scene from their python ID, which is unique. When you add the object with the actuator you can get a handle to that object using the attribute .objectLastCreated from which you can get it’s ID to refer to later. Or if you added the object using GameLogic.addObject() that function returns the handle.

object = act.objectLastCreated
object_id = id(object)

get_object = scene.objects.from_id(object_id)

Where act is the add actuator. There might be some syntax mistake, for details check:

Hey thanks,

This may proof very handy