Пример #1
0
        bool IsRoot(ObjectProxy thing, out RootPathReason reason)
        {
            reason = RootPathReason.None;

            if (thing.staticField.isValid)
            {
                reason = RootPathReason.Static;
                return(true);
            }

            if (thing.managed.isValid)
            {
                return(false);
            }

            if (thing.gcHandle.isValid)
            {
                return(false);
            }

            if (!thing.native.isValid)
            {
                throw new System.ArgumentException("Unknown type: " + thing.GetType());
            }

            if (thing.native.isManager)
            {
                reason = RootPathReason.UnityManager;
                return(true);
            }

            if (thing.native.isDontDestroyOnLoad)
            {
                reason = RootPathReason.DontDestroyOnLoad;
                return(true);
            }

            if ((thing.native.hideFlags & HideFlags.DontUnloadUnusedAsset) != 0)
            {
                reason = RootPathReason.DontUnloadUnusedAsset;
                return(true);
            }

            if (thing.native.isPersistent)
            {
                return(false);
            }

            if (thing.native.type.IsSubclassOf(thing.snapshot.coreTypes.nativeComponent))
            {
                reason = RootPathReason.Component;
                return(true);
            }

            if (thing.native.type.IsSubclassOf(thing.snapshot.coreTypes.nativeGameObject))
            {
                reason = RootPathReason.GameObject;
                return(true);
            }

            if (thing.native.type.IsSubclassOf(thing.snapshot.coreTypes.nativeAssetBundle))
            {
                reason = RootPathReason.AssetBundle;
                return(true);
            }

            reason = RootPathReason.Unknown;
            return(true);
        }
Пример #2
0
 public RootPath(RootPathReason reason, ObjectProxy[] path)
     : base()
 {
     this.reason  = reason;
     this.m_Items = path;
 }