コード例 #1
0
        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);
            }
        }
コード例 #2
0
 public void Start()
 {
     if (LateUpdate && (!ExposedScriptConfigurationManagerAsset.Instance.PreInitializationEnabled || !PreInitializationEnabled))
     {
         ExposedLogger.Info(name + " - without caching start", this);
         UpdateReferences();
     }
 }
コード例 #3
0
 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();
     }
 }
コード例 #4
0
 private static void CacheInstances()
 {
     if (ExposedScriptConfigurationManagerAsset.Instance.EditorPreInitializationEnabled)
     {
         if (EditorApplication.isPlayingOrWillChangePlaymode && !EditorApplication.isPlaying)
         {
             ExposedLogger.Info("Running EXPOSED playmode preprocessor.");
             UpdateReferences();
         }
     }
 }
コード例 #5
0
        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);
                }
            }
        }
コード例 #6
0
 public static void NewConfig()
 {
     ExposedLogger.Info("Creating new nest configuration");
     CreateAsset <ExposedConfiguration>("ExposedConfiguration.asset");
 }