is it possible to add a game property to an object while the bge is running?

I realize you can access them easily enough, I am not asking about accessing properties just so that's clear.

I'm well aware that you can use a string as a list in the bge like so / which would be perfectly fine in most scenario's(and the same goes for dictionaries.) but I think it'd be more professional if you could physically add properties to objects in real time.

    import bge
    scene = bge.logic.getCurrentScene()

postscript: this probably isn't important but i'm using blender v2.78a


1 Answer 1


Yes, that's possible.

Game objects behave like dictionaries, so you can just assign any value to any name (no need for adding a property in the Blender GUI):

scene.some_object["new_property"] = "Hello"

You can even store lists, objects and any other data type in these properties.

  • $\begingroup$ this is considerably easier than I thought it was going to be >.>. and i've used bge for quite a long time now lmao $\endgroup$
    – Frederick
    Jul 24, 2019 at 6:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.