Hello, I have an issue about using scene.addObject via python component script
I have no idea why object which added by addObject doesn’t show as solid object in runtime. but in the viewport object show normally.
here is runtime
here is viewport
here is a addObject script
It obviously has object there. have no clue why it doesn’t show
Is there a reason you’re passing the object itself to addObject, rather than just the name?
eg:
scene.addObject(“Enemy”, “Spawn”)
Either way, is the console telling you anything?
EDIT:
What is “self”? If it’s the logic brick then you need “owner”, not “object”
eg self.owner.scene
1 Like
I’m not good at logic brick.
these scripts are used as object’s components, so I approach scene through self.object
I try using name as you recommend but it give a same result.
and in the console didn’t have any errors.
I printed hitObjectList of Near sensor to see how sensor work and it can detect right along to the amount of object that I specified.
I found the way to fix this issue.
It’s my fault that I don’t really understand how addObject method works.
I found that the origin object which want to be added and reference object need to be in the same collection.