#if UNITY_EDITOR using UnityEditor; #endif using UnityEngine; // Disable 'obsolete' warnings #pragma warning disable 0618 [HelpURL("https://geom.io/bakery/wiki/index.php?title=Manual#Bakery_Lightmapped_Prefab")] [DisallowMultipleComponent] public class BakeryLightmappedPrefab : MonoBehaviour { #if UNITY_EDITOR public bool enableBaking = true; public bool receiveLightmaps = 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(); var comps2 = gameObject.GetComponentsInChildren(); for(int t=0; t<2; t++) { var comps3 = t == 0 ? comps : comps2; for(int c=0; c