Example #1
0
        protected override bool ValidatePinned(Object[] items)
        {
            if (Application.isPlaying)
            {
                return(false);
            }

            foreach (var item in items)
            {
                var fileId = LocalIdentifierInFile.Get(item);

                // Sceneに保存されていないGameObjectは登録不可.
                if (fileId == item.GetInstanceID())
                {
                    return(false);
                }

                // Hierarchyのオブジェクト以外が登録不可.
                if (EditorUtility.IsPersistent(item))
                {
                    return(false);
                }
            }

            return(true);
        }
Example #2
0
 private void UpdatePinnedObjectIds()
 {
     pinnedObjectIds = pinnedObject
                       .Select(x => x as GameObject)
                       .Where(x => x != null)
                       .Select(x => LocalIdentifierInFile.Get(x))
                       .ToArray();
 }
Example #3
0
            //----- method -----

            internal TargetAssetInfo(Object target, string path, string fullPath)
            {
                this.guid = GetGuid(fullPath);
                this.AssetReferenceInfo = new AssetReferenceInfo(path, target);

                // DLLでMonoScriptだったらDLLの中のコンポーネントなのでfileIDを取り出す.
                if (path.EndsWith(".dll") && target is MonoScript)
                {
                    fileId = LocalIdentifierInFile.Get(target).ToString();
                }
            }
Example #4
0
        protected override void Load()
        {
            currentScene = SceneManager.GetActiveScene();

            var pinned = ProjectPrefs.GetString(PinnedPrefsKey);

            if (string.IsNullOrEmpty(pinned))
            {
                return;
            }

            // Hierarchy上のGameObjectを検索して取得.
            var hierarchyObjects = UnityEditorUtility.FindAllObjectsInHierarchy();

            pinnedObject = pinned
                           .Split(',')
                           .Select(x => hierarchyObjects.FirstOrDefault(y => LocalIdentifierInFile.Get(y).ToString() == x) as Object)
                           .Where(x => x != null)
                           .ToList();

            UpdatePinnedObjectIds();
        }