写真のように一つ変えるとすべて変更されてしまうのですがどのように対応したらよいでしょうか。
using
1using System.Collections.Generic; 2using UnityEngine; 3using UnityEditor; 4 5[CustomEditor(typeof(BossInfo))] 6public class BossEditor : Editor 7{ 8 9 public override void OnInspectorGUI() 10 { 11 12 BossInfo boss = target as BossInfo; 13 14 EditorGUILayout.BeginVertical(GUI.skin.box); 15 EditorGUILayout.LabelField("ステータス"); 16 EditorGUILayout.BeginHorizontal(); 17 EditorGUILayout.LabelField("体力/現在値"); 18 boss.hp = EditorGUILayout.FloatField(boss.hp); 19 if (GUILayout.Button("Reset")) 20 { 21 Debug.Log("Reset"); 22 boss.hp = boss.max_hp; 23 } 24 EditorGUILayout.EndHorizontal(); 25 EditorGUILayout.BeginHorizontal(); 26 EditorGUILayout.LabelField("体力/最大値"); 27 boss.max_hp = EditorGUILayout.FloatField(boss.max_hp); 28 EditorGUILayout.EndHorizontal(); 29 EditorGUILayout.EndVertical(); 30 31 if( GUILayout.Button("Attck!!")) 32 { 33 boss.hp -= 1; 34 } 35 36 EditorGUILayout.BeginVertical(GUI.skin.box); 37 EditorGUILayout.LabelField("ウェーブ数"); 38 EditorGUILayout.BeginHorizontal(); 39 boss.wave = EditorGUILayout.IntField(boss.wave); 40 EditorGUILayout.EndHorizontal(); 41 EditorGUILayout.LabelField("攻撃変化"); 42 for (int i = 1; i <= boss.wave; i++)**//この部分** 43 { 44 EditorGUILayout.BeginVertical(GUI.skin.box); 45 EditorGUILayout.LabelField("Wave" + i); 46 //関数またはフォルダから攻撃を選ぶプルダウンを表示 47 //選ばれたらそれぞれの設定可能パラメータの表示 48 boss.attack =(BossInfo.ATTACK) EditorGUILayout.EnumPopup("攻撃", boss.attack); 49 EditorGUILayout.EndVertical(); 50 } 51 EditorGUILayout.EndVertical(); 52 53 } 54} 55 56Editor
using
1using System.Collections; 2using System.Collections.Generic; 3using System.IO; 4using System.Reflection; 5using UnityEngine; 6using UnityEngine.Events; 7 8 9public class BossInfo : MonoBehaviour 10{ 11 [SerializeField, Tooltip("体力/現在値")] 12 private float m_hp; 13 [SerializeField, Tooltip("体力/最大値")] 14 private float m_hp_max; 15 [SerializeField, Tooltip("ウェーブ数")] 16 private int m_wave; 17 public enum ATTACK 18 { 19 RollingShot, 20 RandomShot, 21 HomingShot, 22 SpecialShot, 23 RoundShot, 24 25 } 26 27 public ATTACK attack; 28 public float hp { get { return m_hp; } set { m_hp = value; } } 29 public float max_hp { get { return m_hp_max; } set { m_hp_max = value; } } 30 public int wave { get {return m_wave; } set { m_wave = value; } } 31 32} 33BossInfo
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。