- Home /
Question by
Bearable · Apr 19, 2020 at 03:59 PM ·
instantiatebuildsceneadditiveprocessing
Creating a primitive during scene preprocessing?
I have an implementation of IProcessSceneWithReport
that adds some objects to scenes for debugging purposes:
public class Test: IProcessSceneWithReport
{
public int callbackOrder => 0;
public void OnProcessScene(Scene scene, BuildReport report)
{
GameObject.CreatePrimitive(PrimitiveType.Cube);
// adjust the created cube position, etc...
}
}
However, during gameplay I load and unload multiple scenes additively. This means that in play mode, OnProcessScene
is called before my scene is loaded and set active. So the primitive gets added to some other scene (whichever happened to be active at the time).
How can I force the primitive to spawn in the specific scene being processed, both during play mode and build, regardless of which scene is active?
Thanks!
Comment