/////////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// OnInspectorGUI /// </summary> /////////////////////////////////////////////////////////////////////////////////////////////////////// public override void OnInspectorGUI() { GenericMeshDecal decal = (GenericMeshDecal)target; bool updateShape = false; if (decal.material) { string actualMaterialName = decal.material.name; decal.material = EditorBasicFunctions.DrawMeshDecalElements(decal, false, new Rect(0, 0, EditorGUIUtility.currentViewWidth, EditorGUIUtility.singleLineHeight), null); if (decal.material.name != actualMaterialName) { updateShape = true; //Debug.Log ("Material Change: "+decal.material); decal.GetComponent <Renderer>().sharedMaterial = decal.material; } } if (GUI.changed || updateShape) { decal.UpdateDecallShape(false, false); } }
/////////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// DrawMeshDecalsMode /// # Draw al gui buttons, checboxes, ... to handle and insert mesh decals in scene /// </summary> /////////////////////////////////////////////////////////////////////////////////////////////////////// void DrawMeshDecalsMode() { Material actualMaterial = EditorBasicFunctions.DrawMeshDecalElements(meshDecalPrefab, true, position, configSaver); if (actualMaterial) { EditorBasicFunctions.DrawEditorBox(actualMaterial.name, Color.yellow, position); } else { EditorBasicFunctions.DrawEditorBox("No decal selected to put!", Color.gray, position); } }