// --------------------------------------------------------------------------- // Create a New Grid in the Hierarchy from the Grid Prefab // --------------------------------------------------------------------------- static void CreateNewGrid() { // Create new Grid GameObject gridGameObject = GameObject.CreatePrimitive(PrimitiveType.Plane); gridGameObject.transform.position = new Vector3(0f, 0f, 0f); gridGameObject.name = Const.Grid.defaultName; gridGameObject.layer = Const.Grid.gridLayer; // Configure Grid GameObject MeshRenderer MeshRenderer gridMeshRenderer = gridGameObject.GetComponent <MeshRenderer>(); gridMeshRenderer.lightProbeUsage = UnityEngine.Rendering.LightProbeUsage.Off; gridMeshRenderer.reflectionProbeUsage = UnityEngine.Rendering.ReflectionProbeUsage.Off; gridMeshRenderer.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off; gridMeshRenderer.receiveShadows = false; // Configure Grid GameObject Material if (gridMaterial == null) { gridMaterial = LoadingHelper.GetGridMaterial(); } gridMaterial.SetColor("_Color", Settings.Data.gui.grid.tintColor); gridMeshRenderer.material = gridMaterial; // Add MAST_Grid_Component script to grid and pass grid preferences to it UpdateGridSettings(); // Return the grid to its last saved height MoveGridToNewHeight(); // Hide the grid in the hierarchy gridGameObject.hideFlags = HideFlags.HideInHierarchy; }