You can’t load anything from another running scene.
You can load objects from scenes from a .blend file via LibLoad.
You can assign the object to a group and instantiate the group in an hidden layer to addObject() copies of it. It does not matter if you link or append the group.
can you please provide an example code for me? i never use libload before. So if we loads the scene, the whole scene is loaded? I only need to add the main character , (many objects are parented to it). Is there other way for that?
When a scene just starts, the libload should function right away
When posting code use [ code][ /code], can you post a blend file please?
I try to use your code (I really don’t undertand why it uses len(functions)), it does work. exactly what do you want to do? spawn the complete character? (CharacterCube, and its children), if this is what you wan to do, load the file by using “Scene” type, and use addObject for add “CharacterCube”.
The same function doesnt work for me when i want the script to load 1 Cube object (CharacterCube) to my project, that object is the parent of very many objects ( character mesh, character armature, some planes, some empties, ). In the console it says like KX… does not match… something.
when i just let the base cube remesh to the head of character, or hair, eye, cloth, it works…
well, a screenshot of the error? You say that after load the file and use addObject to add one object from the loaded file (which is parent of other objects), it appears an error? try changing the loading type from “Mesh” to “Scene” (and leave the objects in a hidden layer in the loaded file).
Main is the armature of the character, i guess remesh function doesnt work with armatures. But there as you see the CharacterCube (parent of Main) is spawed. but the armature doesnt follow it to the scene (including lower children)
You are trying to spawn “CharacterCube” by replacing the mesh of another object by CharacterCube’s mesh? that will not work, it’s even not “spawn”, you are just replacing one mesh. AddObject is a function of an scene class, for example: bge.logic.getCurrentScene().addObject(“object to add”, “base object”)