void ApplyGlobalSettings() { ShadowProjector targetShadowProj = (ShadowProjector)target; Object[] shadowProjectors = GameObject.FindObjectsOfType(typeof(ShadowProjector)); foreach (ShadowProjector shadowProj in shadowProjectors) { if (shadowProj.GetInstanceID() != targetShadowProj.GetInstanceID()) { shadowProj.GlobalProjectionDir = targetShadowProj.GlobalProjectionDir; shadowProj.GlobalShadowResolution = targetShadowProj.GlobalShadowResolution; shadowProj.GlobalShadowCullingMode = targetShadowProj.GlobalShadowCullingMode; shadowProj.GlobalCutOffDistance = targetShadowProj.GlobalCutOffDistance; shadowProj.GlobalFlipX = targetShadowProj.GlobalFlipX; shadowProj.GlobalFlipY = targetShadowProj.GlobalFlipY; EditorUtility.SetDirty(shadowProj); } } }
public void OnEnable() { ShadowProjector targetShadowProj = (ShadowProjector)target; Object[] shadowProjectors = GameObject.FindObjectsOfType(typeof(ShadowProjector)); foreach (ShadowProjector shadowProj in shadowProjectors) { if (shadowProj.GetInstanceID() != targetShadowProj.GetInstanceID()) { targetShadowProj.GlobalProjectionDir = shadowProj.GlobalProjectionDir; targetShadowProj.GlobalShadowResolution = shadowProj.GlobalShadowResolution; targetShadowProj.GlobalShadowCullingMode = shadowProj.GlobalShadowCullingMode; targetShadowProj.GlobalCutOffDistance = shadowProj.GlobalCutOffDistance; targetShadowProj.GlobalFlipX = shadowProj.GlobalFlipX; targetShadowProj.GlobalFlipY = shadowProj.GlobalFlipY; EditorUtility.SetDirty(shadowProj); break; } } }