private void EditorUpdate() { if (sceneViewCameraData.mainCamera != null && sceneViewCameraData.mainCamera.name == sceneViewCameraName) { if (initializingInstances) { if (!gpuiManager.isInitialized) { gpuiManager.Awake(); gpuiManager.InitializeRuntimeDataAndBuffers(); } initializingInstances = false; return; } Camera.onPreCull -= CameraOnPreCull; Camera.onPreCull += CameraOnPreCull; EditorApplication.update -= EditorUpdate; } }
/// <summary> /// <para>Main GPU Instancer initialization Method. Generates the necessary GPUInstancer runtime data from predifined /// GPU Instancer prototypes that are registered in the manager, and generates all necessary GPU buffers for instancing.</para> /// <para>Use this as the final step after you setup a GPU Instancer manager and all its prototypes.</para> /// <para>Note that you can also use this to re-initialize the GPU Instancer prototypes that are registered in the manager at runtime.</para> /// </summary> /// <param name="manager">The manager that defines the prototypes you want to GPU instance.</param> /// <param name="forceNew">If set to false the manager will not run initialization if it was already initialized before</param> public static void InitializeGPUInstancer(GPUInstancerManager manager, bool forceNew = true) { manager.InitializeRuntimeDataAndBuffers(forceNew); }