예제 #1
0
        protected virtual void Awake()
        {
            try {
                runAlongSide = (RunAlongSideAttribute)GetType().GetCustomAttributes(typeof(RunAlongSideAttribute), true)[0];
                baseObject   = GetComponent(Master.VersionData.HasClassData(runAlongSide.TypeString) ? runAlongSide.Type : typeof(Transform));
            } catch (Exception e) {
                Debug.Log($"Failed to get the RunAlongSideAttribute or BaseObject of {GetType().Name} on {gameObject.name}!\n{e.ToString()}");
            }

            try {
                entityDefinition = (EntityDefinitionAttribute)GetType().GetCustomAttributes(typeof(EntityDefinitionAttribute), true)[0];
            } catch (Exception e) {
                Debug.Log($"Failed to get the EntityDefinition of {GetType().Name} on {gameObject.name}!\n{e.ToString()}");
            }

            if (!AssetManager.DataExists(ConfigurationPath))
            {
                SaveConfig();
            }

            LoadConfig();

            Debug.Log($"Successfully added {GetType().Name} to {gameObject.name}!");
        }
예제 #2
0
 private void OnApplicationQuit()
 {
     //Null these out to prevent the game from crashing upon exit.
     runAlongSide = null;
     baseObject   = null;
 }