열차 목업의 내부 확인용 프로젝트
smchoi
2024-07-24 ff74c0073046f0e086eb7d355950bda39937c92c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*using UnityEngine;
using UnityEditor;
using ModelSwitch;
[CustomEditor(typeof(ModelSelector))] 
public class ModelArrayEditor : Editor
{
 
   
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector(); 
 
        ModelSelector script = (ModelSelector)target; 
 
        
        if (script.models == null)
            script.models = new GameObject[0];
 
        EditorGUILayout.Space(10f); // 간격 추가
        string objName = "Model";
        
        
 
        if (GUILayout.Button("Auto Populate Models"))
        {
            if (objName == "")
            {
                Debug.LogWarning("부모 오브젝트의 이름을 입력해주세요.");
            }
            else
            {
                Transform modelTransform = GameObject.Find(objName).transform; // "model" 오브젝트를 찾습니다.
 
                if (modelTransform != null)
                {
                    
                    script.models = new GameObject[modelTransform.childCount];
                    for (int i = 0; i < modelTransform.childCount; i++)
                    {
                        script.models[i] = modelTransform.GetChild(i).gameObject;
                    }
                }
                else
                {
                    Debug.LogWarning("모델을 찾을 수 없습니다.");
                }
            }
        }
    }
}*/