예제 #1
0
        public static void GetComponentName <T>(Item item, ref string name) where T : Component
        {
            try
            {
                Exterior exterior = item.GetComponent <Exterior>();

                List <string> options = exterior.GetHolderComponentNames <T>();

                int selectedIdx = options.Contains(name) ? options.IndexOf(name) : 0;

                name = options[EditorGUILayout.Popup(typeof(T).ToString() + ": ", selectedIdx, options.ToArray())];
            }
            catch (NullReferenceException) { EditorGUILayout.LabelField("Need Exterior type component"); }
        }
예제 #2
0
        public static void GetComponentsNames <T>(Item item, ref int size, List <string> names) where T : Component
        {
            try
            {
                Exterior exterior = item.GetComponent <Exterior>();

                int s = EditorGUILayout.IntField("Size: ", size);

                if (s > 0)
                {
                    size = s;
                }

                exterior.Options <T>(ref size, names);
            }
            catch (NullReferenceException) { EditorGUILayout.LabelField("Need Exterior type component"); }
        }