#if UNITY_EDITOR using UnityEditor; #endif using UnityEngine; // Disable 'obsolete' warnings #pragma warning disable 0618 [DisallowMultipleComponent] public class BakeryLightmappedPrefab : MonoBehaviour { #if UNITY_EDITOR public bool enableBaking = true; public bool ignoreWarnings = false; public string errorMessage; public bool IsValid() { errorMessage = ""; if (!enableBaking) { return false; } if (ignoreWarnings) return true; bool isPartOfPrefab = PrefabUtility.GetPrefabType(gameObject) == PrefabType.PrefabInstance; if (!isPartOfPrefab) { errorMessage = "this GameObject is not a prefab"; return false; } bool prefabIsRoot = PrefabUtility.FindPrefabRoot(gameObject) == gameObject; if (!prefabIsRoot) { errorMessage = "this GameObject is not a root prefab object"; return false; } var transforms = GetComponentsInChildren(); for(int i=0; i= 0) continue; if (mods[i].target != null && mods[i].target.name == gameObject.name) { if (mods[i].propertyPath.Contains("m_LocalPosition")) continue; if (mods[i].propertyPath.Contains("m_LocalRotation")) continue; if (mods[i].propertyPath.Contains("m_LocalScale")) continue; } errorMessage = "prefab contains unapplied data (" + mods[i].target+"."+mods[i].propertyPath + ")"; return false; } } var comps = gameObject.GetComponents(); var comps2 = gameObject.GetComponentsInChildren(); for(int t=0; t<2; t++) { var comps3 = t == 0 ? comps : comps2; for(int c=0; c