Ejemplo n.º 1
0
        public void onPostLoad()
        {
            if (items.Count == 0)
            {
                return;
            }

            // find scene GameObjects and cache their id
            var sceneGOs = MiscEditorUtility.findSceneObjects <GameObject>();
            Dictionary <int, Object> sceneGoIds = new Dictionary <int, Object>(sceneGOs.Length);

            foreach (var sceneGO in sceneGOs)
            {
                int id = MiscEditorUtility.getLocalIdentifierInFile(sceneGO);
                if (id == 0)
                {
                    continue;                     // this GO is not saved yet
                }
                sceneGoIds.Add(id, sceneGO);
            }

            // each item will try to find its GO by its id
            foreach (var item in items)
            {
                item.onPostLoad(sceneGoIds);
            }
        }
Ejemplo n.º 2
0
        public void onPreSave()
        {
            if (!unityObject)
            {
                return;
            }

            sceneObjectId = AssetDatabase.Contains(unityObject)
                                                                ? -1
                                                                : MiscEditorUtility.getLocalIdentifierInFile(unityObject);

            unityObjectName = unityObject.name;
        }