public static void UpdateReferences() { ExposedLogger.Info("Updating EXPOSED references"); ExposedReferences[] exposedReferences = Resources.FindObjectsOfTypeAll <ExposedReferences>(); List <ExposedReferences> sceneConfigurations = new List <ExposedReferences>(); foreach (ExposedReferences exposedReference in exposedReferences) { //only scene objects if (exposedReference.hideFlags == HideFlags.None) { sceneConfigurations.Add(exposedReference); } //prefabs and others else { //for prefabs, caching is always disabled (otherwise no references through rules will be found) exposedReference.PreInitializationEnabled = false; //EditorUtility.SetDirty(exposedReference); } } //because of local caching settings, prefabs has to be modified before scene instances foreach (var sceneConfiguration in sceneConfigurations) { sceneConfiguration.PreInitializationEnabled = true; sceneConfiguration.UpdateReferences(); EditorUtility.SetDirty(sceneConfiguration); } }
public void Start() { if (LateUpdate && (!ExposedScriptConfigurationManagerAsset.Instance.PreInitializationEnabled || !PreInitializationEnabled)) { ExposedLogger.Info(name + " - without caching start", this); UpdateReferences(); } }
public static void OnPostprocessScene() { //it is fired also in playmode in editor after playmode is entered (not before) if (ExposedScriptConfigurationManagerAsset.Instance.BuildPreInitializationEnabled && !EditorApplication.isPlaying) { ExposedLogger.Info("Running EXPOSED scene postprocessor."); ExposedInitializator.UpdateReferences(); } }
private static void CacheInstances() { if (ExposedScriptConfigurationManagerAsset.Instance.EditorPreInitializationEnabled) { if (EditorApplication.isPlayingOrWillChangePlaymode && !EditorApplication.isPlaying) { ExposedLogger.Info("Running EXPOSED playmode preprocessor."); UpdateReferences(); } } }
public void UpdateReferences() { ExposedLogger.Info(name + " - updating references", this); var componentObtainer = ExposedApplicationDi.Instance.Container.Resolve <IComponentObtainer>(); var fieldsProcessor = ExposedApplicationDi.Instance.Container.Resolve <IFieldsProcessor>(); var fieldsObtainer = ExposedApplicationDi.Instance.Container.Resolve <IFieldsObtainer>(); List <ExposedMapping> scriptMappings = componentObtainer.GetComponentMappingsOnSameGameObject(this); //Debug.LogError(gameObject, gameObject); foreach (var scriptMapping in scriptMappings) { ExposedConfiguration configuration = GetConfigForScript(scriptMapping.AffectedComponent); if (configuration != null) { List <FieldInfo> fields = fieldsObtainer.GetReferenceFieldsForType(scriptMapping.Type); fieldsProcessor.ProcessFieldsForType(fields, scriptMapping.AffectedComponent, configuration); } } }
public static void NewConfig() { ExposedLogger.Info("Creating new nest configuration"); CreateAsset <ExposedConfiguration>("ExposedConfiguration.asset"); }