I’m getting errors when trying to instance a loaded GLB, “Instances should only be created for meshes with geometry.”
Reading up on past threads and see that we should use instantiateHierarchy on the loaded meshes array. Tried that, but the instance a) doesn’t seem to appear on screen and b) when moved to a different position using the inspector, throws the “with geometry” error.
In my PG above, I’d simplified out the AssetsManager component to focus on the problem, but was then worried after seeing your example that it’d be incompatible with AssetsManager. Looks like there’s already a fix there though. Trying it shortly.
So basically, that’s what I used to do, but I stopped because some models would just not render, bounding boxes display stopped working and a whole lot of other related things. For example, when you change the inserted but hidden models’ parent - instantiateModelsToScene stops working completely.
So - I suppose all of these are bugs?
Begrudgingly, what I do currently is hide the warnings and not call addAllToScene.
On that note - would it maybe be possible not to print this warning millions of times in the render loop?
I’m sure being told once per mesh would be fine… If it’s a warning, it doesn’t really warrant killing the developer console withing a minute of starting it, no?
edit: maybe it wasn’t clear, but not calling addAllToScene makes all these strange issues go away for me. except those warnings.
I have thousands of models in a scene, them being loaded does not imply they will be instantiated immediately (or ever), also I’d like to use the inspector (which implies they can’t just all sit in the root, that makes the inspector rather unusable).
won’t work, because the instantiateModelsToScene method only deals with root objects, i.e. objects with parent === null.
If what you want is parenting to avoid having lots of objects at the root level in the inspector, set a parent as you do, before calling duplicate do task.loadedContainer.rootNodes.parent = null; and after it returns set task.loadedContainer.rootNodes.parent = group; again.