コード例 #1
0
        protected override T DetermineValue(T cachedValue)
        {
            if (string.IsNullOrEmpty(UniqueName))
            {
                return(null);
            }

            T value = cachedValue;

            // If MonoBehaviour was destroyed, nullify the value.
            if (value != null && value.Equals(null))
            {
                value = null;
            }

            // If value exists, return it.
            if (value != null)
            {
                return(value);
            }

            ISceneObject sceneObject = RuntimeConfigurator.Configuration.SceneObjectRegistry.GetByName(UniqueName);

            // Can't find training scene object with given UniqueName, value is null.
            if (sceneObject == null)
            {
                return(value);
            }

            value = sceneObject.GetProperty <T>();
            return(value);
        }