Jump to content
Unity Insider Forum

Kaan38

Members
  • Posts

    6
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Kaan38's Achievements

Newbie

Newbie (1/3)

0

Reputation

  1. Servus, ich wollte einen Drawer für mein Spiel machen aber ich bekomme gerade 19 mal so eine ähnliche Meldung. Könnte mir jemand Helfen? Assets/Scripts/Editor/ShapeDataDrawer.cs(24,31): error CS1061: 'ShapeData' does not contain a definition for 'board' and no accessible extension method 'board' accepting a first argument of type 'ShapeData' could be found (are you missing a using directive or an assembly reference?) using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEditor; [CustomEditor(typeof(ShapeData), false)] [CanEditMultipleObjects] [System.Serializable] public class ShapeData : Editor { private ShapeData ShapeDataInstance => target as ShapeData; public override void OnInspectorGUI() { serializedObject.Update(); ClearBoardButton(); EditorGUILayout.Space(); DrawColumnsInputFields(); EditorGUILayout.Space(); if (ShapeDataInstance.board != null && ShapeDataInstance.columns > 0 && ShapeDataInstance.rows > 0) { DrawBoardTable(); } serializedObject.ApplyModifiedProperties(); if (GUI.changed) { EditorUtility.SetDirty(ShapeDataInstance); } } private void ClearBoardButton() { if (GUILayout.Button("Clear Board")) { ShapeDataInstance.Clear(); } } private void DrawColumnsInputFields() { var columnsTemp = ShapeDataInstance.columns; var rowsTemp = ShapeDataInstance.rows; ShapeDataInstance.columns = EditorGUILayout.IntField("Columns", ShapeDataInstance.columns); ShapeDataInstance.rows = EditorGUILayout.IntField("Rows", ShapeDataInstance.rows); if ((ShapeDataInstance.columns != columnsTemp || ShapeDataInstance.rows != rowsTemp) && ShapeDataInstance.columns > 0 && ShapeDataInstance.rows > 0) { ShapeDataInstance.CreateNewBoard(); } } private void DrawBoardTable() { var tableStyle = new GUIStyle("box"); tableStyle.padding = new RectOffset(10, 10, 10, 10); tableStyle.margin.left = 32; var headerColumnStyle = new GUIStyle(); headerColumnStyle.fixedWidth = 65; headerColumnStyle.alignment = TextAnchor.MiddleCenter; var rowStyle = new GUIStyle(); rowStyle.fixedHeight = 25; rowStyle.alignment = TextAnchor.MiddleCenter; var dataFieldStyle = new GUIStyle(EditorStyles.miniButtonMid); dataFieldStyle.normal.background = Texture2D.grayTexture; dataFieldStyle.onNormal.background = Texture2D.whiteTexture; for (var row = 0; row < ShapeDataInstance.rows; row++) { EditorGUILayout.BeginHorizontal(headerColumnStyle); for (var column = 0; column < ShapeDataInstance.columns; column++) { EditorGUILayout.BeginHorizontal(rowStyle); var data = EditorGUILayout.Toggle(ShapeDataInstance.board[row].column[column], dataFieldStyle); ShapeDataInstance.board[row].column[column] = data; EditorGUILayout.EndHorizontal(); } EditorGUILayout.EndHorizontal(); } } }
×
×
  • Create New...