void OnEnable() { SerializedObject so = new SerializedObject(target); sp1 = so.FindProperty("SunDirectionCharacter"); sp2 = so.FindProperty("SunColor"); sp3 = so.FindProperty("SunColorIntensity"); sp4 = so.FindProperty("AmbientColor"); sp5 = so.FindProperty("AmbientColorIntensity"); Sun sun = target as Sun; sun.Apply(); }