void OnEnable() { hideFlags = HideFlags.DontSave; m_ShowOverlapPreview.valueChanged.AddListener(Repaint); m_ShowOverlapPreview.speed = 1.5f; m_ShowWidePreview.valueChanged.AddListener(Repaint); m_ShowWidePreview.speed = 1.5f; m_PreviewResizer.Init("ObjectPickerPreview"); m_PreviewSize = m_PreviewResizer.GetPreviewSize(); // Init size if (s_GridAreaPriorityKeyboardEvents == null) { s_GridAreaPriorityKeyboardEvents = new HashSet <Event> { Event.KeyboardEvent("up"), Event.KeyboardEvent("down"), }; } AssetPreview.ClearTemporaryAssetPreviews(); SetupPreview(); m_Debounce = Delayer.Debounce(_ => { FilterSettingsChanged(); Repaint(); }); }
void OnEnable() { hideFlags = HideFlags.DontSave; m_ShowOverlapPreview.valueChanged.AddListener(Repaint); m_ShowOverlapPreview.speed = 1.5f; m_ShowWidePreview.valueChanged.AddListener(Repaint); m_ShowWidePreview.speed = 1.5f; m_PreviewResizer.Init("ObjectPickerPreview"); m_PreviewSize = m_PreviewResizer.GetPreviewSize(); // Init size AssetPreview.ClearTemporaryAssetPreviews(); SetupPreview(); }
public void OnEnable() { instances.Add(this); if (clipboardView == null) { clipboardView = CreateInstance <GridPaintPaletteClipboard>(); clipboardView.owner = this; clipboardView.hideFlags = HideFlags.HideAndDontSave; clipboardView.unlocked = false; } if (m_PaintableSceneViewGrid == null) { m_PaintableSceneViewGrid = CreateInstance <PaintableSceneViewGrid>(); m_PaintableSceneViewGrid.hideFlags = HideFlags.HideAndDontSave; } GridPaletteBrushes.FlushCache(); EditMode.editModeStarted += OnEditModeStart; EditMode.editModeEnded += OnEditModeEnd; GridSelection.gridSelectionChanged += OnGridSelectionChanged; GridPaintingState.RegisterPainterInterest(this); GridPaintingState.scenePaintTargetChanged += OnScenePaintTargetChanged; GridPaintingState.brushChanged += OnBrushChanged; SceneView.onSceneGUIDelegate += OnSceneViewGUI; PrefabUtility.prefabInstanceUpdated += PrefabInstanceUpdated; AssetPreview.SetPreviewTextureCacheSize(256, GetInstanceID()); wantsMouseMove = true; wantsMouseEnterLeaveWindow = true; if (m_PreviewResizer == null) { m_PreviewResizer = new PreviewResizer(); m_PreviewResizer.Init("TilemapBrushInspector"); } minSize = new Vector2(240f, 200f); if (palette == null && TilemapEditorUserSettings.lastUsedPalette != null && GridPalettes.palettes.Contains(TilemapEditorUserSettings.lastUsedPalette)) { palette = TilemapEditorUserSettings.lastUsedPalette; } Tools.onToolChanged += ToolChanged; ShortcutIntegration.instance.contextManager.RegisterToolContext(m_ShortcutContext); }