for ob in own['Stored'][point[1]]:
added = own.scene.addObject(ob[0],own.scene.objects['Empty'],0)
added.worldPosition = ob[1]
for obj in added:
if "Text" in added:
added['Text'] = ob[2]
I have all the values written in a list and I want to access the number 2 value but only if the added object has the property Text.
How can I run a loop for objects in an added object?
This gives me an error: TypeError: 'KX_GameObject' object is not iterable
Thank you for your suggestion but that doesnât seem to be the right answer.
the âaddedâ object represents all the objects in the list and not itâs children.
I would like to somehow differentiate the objects from the list if they had a certain property.
For example, the list looks like this:
The first value is the object, the second is its location and the third is its property.
How can I access for example, if the added object has a property named âproperty2â?
In your case the code would need to be slightly different, but from what I can see I think you can figure the rest out yourself ; ) If not let me know and Iâll try to help.
Edit: Removed an unnecessary line, and reuploaded test file.
Edit2: Clarity.
Ok, thank you.
I didnât know if Iâve written it correctly.
For some reason, I thought that I needed another loop for objects to determine if the object has the property or not. But that shouldnât be the case because there is already a loop for an object at the beginning of the code and a simple check afterward if the property is in the added object should be enough.