This is my first post, I’m still farely new, please bear with me.
I would like to use LibLoad and addObject for my asset library. I need ‘Scene’ from LibLoad because all my assets have logic bricks and properties attached to them and these need to be transferred as well, not just the meshes.
I have managed to use a basic script for LibLoad here:
from bge import logic path = logic.expandPath('//test_library_01.blend') logic.LibLoad(path,'Scene')
This LibLoad script is applied to an Empty on layer2 with an Always Sensor. It works fine, when layer2 is active I can see the library loaded, no issues.
Then I use this addObject script:
import bge from bge import logic scene = logic.getCurrentScene() scene.addObject("Suzanne","Empty_L1")
It is applied to empty object “Empty_L1” on layer1 with a “spacebar” Keyboard Sensor. “Suzanne” is a monkey head that is on the main .blend file in layer2 originally. It is not imported with the LibLoad. When I hit “spacebar” Suzanne is loaded from layer2 onto layer1. Again, the script works fine, no issues.
The problem is when instead of “Suzanne” I input an object name “insert_3” from the LibLoad library. Nothing happens. The console error message that I get is this:
“ValueError: scene.addObject(object, reference, time): KX_Scene (first argument), requested name “insert_3” did not match any KX_GameObject in this scene”
I am trying to get a few working scripts together for operations that I need that the logic bricks don’t provide. Then just cut/paste as needed. This one has me very stumped… Please help.