internal static void UpdateEditorTools(BrushToolsAttribute brushToolsAttribute) { if (IsCachedEditorToolsInvalid()) { InstantiateEditorTools(); } EditorTool[] editorTools; if (brushToolsAttribute?.toolList == null || brushToolsAttribute.toolList.Count == 0) { editorTools = s_DefaultTilemapEditorTools; } else { editorTools = new EditorTool[brushToolsAttribute.toolList.Count]; for (int i = 0; i < brushToolsAttribute.toolList.Count; ++i) { var toolType = brushToolsAttribute.toolList[i]; if (!s_TilemapEditorToolsMap.TryGetValue(toolType, out EditorTool editorTool)) { editorTool = (EditorTool)ScriptableObject.CreateInstance(toolType); s_TilemapEditorToolsMap.Add(toolType, editorTool); } editorTools[i] = editorTool; } } GridPaintingState.SetBrushTools(editorTools); }
internal static void UpdateBrushToolbar() { BrushToolsAttribute toolAttribute = null; if (instance.m_Brush != null) { toolAttribute = (BrushToolsAttribute)instance.m_Brush.GetType().GetCustomAttribute(typeof(BrushToolsAttribute), false); } TilemapEditorTool.UpdateEditorTools(toolAttribute); }