public override void DrawFloatingOriginFields() { EditorGUILayout.PropertyField(prop_useFloatingOriginHandler, GPUInstancerEditorConstants.Contents.useFloatingOriginHandler); if (_manager is GPUInstancerTerrainManager) { if (prop_useFloatingOriginHandler.boolValue) { GPUInstancerTerrainManager terrainManager = (GPUInstancerTerrainManager)_manager; if (terrainManager.terrain != null && terrainManager.terrain.transform != _manager.floatingOriginTransform) { Undo.RecordObject(this, "Floating Origin Transform Set"); _manager.floatingOriginTransform = terrainManager.terrain.transform; } } DrawHelpText(GPUInstancerEditorConstants.HELPTEXT_floatingOriginTerrain); } else { if (prop_useFloatingOriginHandler.boolValue) { EditorGUILayout.PropertyField(prop_floatingOriginTransform, GPUInstancerEditorConstants.Contents.floatingOriginTransform); } DrawHelpText(GPUInstancerEditorConstants.HELPTEXT_floatingOriginPrefab); } }
/// <summary> /// <para>Sets the Unity terrain to the GPU Instancer manager and generates the instance prototypes from Unity detail /// prototypes that are defined on the given Unity terrain component.</para> /// <para>Use this to initialize the GPU Instancer detail manager if you want to generate your terrain at runtime. /// See <seealso cref="TerrainGenerator"/> and its demo scene for an example.</para> /// </summary> /// <param name="manager">The manager that defines the prototypes you want to GPU instance.</param> /// <param name="terrain"></param> public static void SetupManagerWithTerrain(GPUInstancerTerrainManager manager, Terrain terrain) { manager.SetupManagerWithTerrain(terrain); }