private void Awake() { tr = transform; if (GetComponentInChildren <MeshRenderer>() != null) { meshRend = GetComponentInChildren <MeshRenderer>(); } else if (GetComponentInChildren <SkinnedMeshRenderer>() != null) { meshRend = GetComponentInChildren <SkinnedMeshRenderer>(); } if (GetComponentInChildren <NavMeshObstacle>() != null) { hasNavObstacle = true; navObstacle = GetComponentInChildren <NavMeshObstacle>(); } if (GetComponentInChildren <SwapMaterial>() != null) { hasSwapMaterial = true; swapMaterial = GetComponentInChildren <SwapMaterial>(); } }
public override void OnInspectorGUI() { DrawDefaultInspector(); SwapMaterial swapMaterial = (SwapMaterial)target; if (GUILayout.Button("Swap for : " + swapMaterial.matSelected.ToString())) { swapMaterial.SetMatToMesh(swapMaterial.matList[(int)swapMaterial.matSelected]); } }