BGE - how to rename an Object - change Objects name

Hello blenderartist-Community :slight_smile:

I’m trying to do an Open-World Game, with first-person-view.
Now I want to enter and Exit a Car.

I am doing this by setting the car_prop to true and deleting the player Cube.
Then by exiting the Car I spawn another Cube at another layer (copy from player_Cube) with an empty, parented to the car.
But the Skript now won’t work, because my player has not longer the player name, but player.001.
Therefore I want to spawn the copyCube and rename it to player, so that the skripts will work again.

Has anyone any Idea how I could do this? Or has anyone any other way how to suceed?

thank you for your help :slight_smile:

P.S.: i got the Idea instead of using names in Skript, i could run the script on Objects with a certain property.
So when I spawn the copy_cube, it has the same object as the player cube, but actually I dont know how to do this.

object.name is a read only property, you can’t change it.

However, you can create a labeling property with a customizable string value and write a check that executes logic if the object’s label property has that value.

You confuse an object with its name.

There is a movie joke that a buttler has to change the name to change, that he “lord” does not need to remember all the names.
What is wrong the lord or the buttler’s name?

Solution: throw away the script … write a good one

I guess you could just make the player invisible when you enter the car and visible when exit.
Why do you copy it to another layer? cant you just spawn him at the start from another layer then delete him when enter a car and spawn him again when exit.

Zerhox has the right idea, making the player cube and all of its children invisible when you enter a car, parenting it to the car, and changing the camera would probably be the best bet, this way you’re keeping your names, properties, etc.