Esempio n. 1
0
        public override void OnEnable()
        {
            base.OnEnable();

            RefreshAvailablePalettes();

            if (_prefabPalette == null)
            {
                prefabPalette = z_EditorUtility.GetDefaultAsset <z_PrefabPalette>(PREFAB_PALETTE_PATH);
            }

            if (prefabPaletteEditor != null)
            {
                Object.DestroyImmediate(prefabPaletteEditor);
                prefabPaletteEditor = null;
            }

            prefabPaletteEditor = (z_PrefabPaletteEditor)Editor.CreateEditor(_prefabPalette);

            // unity won't serialize delegates, so even if prefabPalette isn't null and the editor remains valid
            // the delegate could still be null after a script reload.
            prefabPaletteEditor.onSelectionChanged = SelectedPrefab;

            paletteStyle         = new GUIStyle();
            paletteStyle.padding = new RectOffset(8, 8, 8, 8);

            hitSurfaceIsParent          = new z_LocalPref <bool>("prefab_hitSurfaceIsParent", true);
            avoidOverlappingGameObjects = new z_LocalPref <bool>("prefab_avoidOverlappingGameObjects");
            previewThumbSize            = new z_LocalPref <int>("prefab_previewThumbSize", 64);
        }
Esempio n. 2
0
        public override void OnDisable()
        {
            base.OnDisable();

            if (prefabPaletteEditor != null)
            {
                GameObject.DestroyImmediate(prefabPaletteEditor);
                prefabPaletteEditor = null;
            }
        }