internal void OnValidate() // For editor use { if (debugLogness) { Debug.Log("Validate Object: " + hasSetup, this); } if (hasSetup) { if (!mirrorLight) { lightProp = null; } if (mirrorLight && lightProp == null) { mirror(); } //Run(); if (timeOfDayManager != null) { if (lastSentTime != time && time != 0) // TODO hack, we want manual alteration of the time slider to cause an update, but for exampple 'AgentProperties' causes an 'OnValidate' to be called as part of it's setup //Debug.Log("lastSentTime:"+lastSentTime+":"+time,this); { timeOfDayManager.SetTime(time); lastSentTime = time; } timeOfDayManager.AmIadded(this); // This checks even if timeOfDayManager is not null, does it also have a reference to me, as its possible it got orphaned/forgotten by it Run(); } else { Debug.Log("timeOfDayManager null, new object, run Manager first, running all of them now", this); FindObjectsOfType <TimeOfDayManager>().ToList().ForEach(o => o.Setup()); } if (timeOfDayManager == null) { Debug.LogWarning("no timeOfDayManager wants me!", this); } } }