48 lines
1.1 KiB
C#
48 lines
1.1 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Unity.VisualScripting;
|
|
using UnityEngine;
|
|
|
|
public class Select : MonoBehaviour
|
|
{
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
Debug.Log("Start()");
|
|
HandleSelect(0);
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
// Debug.Log("Update()");
|
|
}
|
|
|
|
void HandleSelect(int idx)
|
|
{
|
|
Debug.Log("HandleSelect");
|
|
int count = transform.childCount;
|
|
Debug.Log("transform.childCount = " + count);
|
|
|
|
if (idx < 0 || idx >= count)
|
|
return;
|
|
Transform frameObj;
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
frameObj = transform.GetChild(i);
|
|
Debug.Log("transform.GetChild(" + i + ")");
|
|
// 예외처리
|
|
if (frameObj == null) continue;
|
|
Debug.Log(frameObj);
|
|
if (i == idx)
|
|
{
|
|
frameObj.localScale = new Vector3(1f, 1f, 1f);
|
|
}
|
|
else
|
|
{
|
|
frameObj.localScale = new Vector3(0f, 0f, 0f);
|
|
}
|
|
}
|
|
}
|
|
}
|