Exemple #1
0
    public virtual UnityEngine.Object Resolve()
    {
        if (!ReferenceRoot.Instance)
        {
            return(null);
        }

#if UNITY_EDITOR
        if (ResolvedObj)
        {
            RefObj = ReferenceRoot.Instance.Get(this);
        }
#endif

        if (!Dynamic && ResolvedObj)
        {
            return(ResolvedObj);
        }
        RefObj = ReferenceRoot.Instance.Get(this);
        if (!RefObj)
        {
            return(null);
        }

        if (string.IsNullOrEmpty(Type))
        {
            ResolvedObj = RefObj.Resolve();
        }
        else
        {
            ResolvedObj = RefObj.Resolve(Type);
        }
        return(ResolvedObj);
    }
Exemple #2
0
    public virtual T Resolve <T>() where T : UnityEngine.Component
    {
        if (!ReferenceRoot.Instance)
        {
            return(null);
        }

#if UNITY_EDITOR
        if (ResolvedObj)
        {
            RefObj = ReferenceRoot.Instance.Get(this);
        }
#endif

        if (!Dynamic && ResolvedObj)
        {
            return(ResolvedObj as T);
        }
        RefObj = ReferenceRoot.Instance.Get(this);
        if (!RefObj)
        {
            ResolvedObj = null;
            return(null);
        }
        ResolvedObj = RefObj.Resolve <T>();
        return(ResolvedObj as T);
    }