Accessing game object property values

Version 2.54 beta

I am trying to access and manipulate game object property values but I get an error. I have attached a simple scene file showing the problem. Below is an example of the code I’m using:

import bpy, bge
print("*********************")
cont = bge.logic.getCurrentController()
own = cont.owner
print(“Object name:”, own.name)
print(“prop value:”, own.prop)

I get an error stating that the object has no attribute ‘prop’. Is the problem in my script, the setup of the property on the game object or should I report this as a bug?

Attachments

test.blend (415 KB)

This should help: own[‘prop’]

Beautiful…thanks! The API could do with a bit of a rewrite with an example in this case!

Thanks for your help!