public void AddCharacter(GameObject obj) { MText_Character newChar = new MText_Character(); if (!obj) { return; } ProcessName(obj.name, out char character, out float spacing); newChar.character = character; newChar.spacing = spacing; newChar.prefab = obj; characters.Add(newChar); }
public void AddCharacter(Mesh mesh) { MText_Character newChar = new MText_Character(); if (!mesh) { return; } ProcessName(mesh.name, out char character, out float spacing); newChar.character = character; newChar.spacing = spacing; newChar.meshPrefab = mesh; characters.Add(newChar); }
void CreateCharacterList() { GUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Char -", GUILayout.MaxWidth(45)); EditorGUILayout.LabelField("Spacing -", GUILayout.MaxWidth(65)); EditorGUILayout.LabelField("Prefab -", GUILayout.MaxWidth(55)); EditorGUILayout.LabelField("or Mesh Asset"); GUILayout.EndHorizontal(); EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); for (int i = 0; i < myTarget.characters.Count; i++) { GUILayout.BeginHorizontal(); //if (characters.arraySize > 0) if (characters.arraySize > i) { EditorGUILayout.PropertyField(characters.GetArrayElementAtIndex(i), GUIContent.none); if (GUILayout.Button("-", GUILayout.MaxWidth(30))) { myTarget.characters.RemoveAt(i); } } GUILayout.EndHorizontal(); } if (GUILayout.Button("+")) { MText_Character character = new MText_Character(); myTarget.characters.Add(character); EditorUtility.SetDirty(target); } }