SceneManager.GetActiveScene
반환
Scene 현재 활성화 된 씬
설명
현재 활성화 된 씬을 가져옵니다.
현재 활성화된 장면은 스크립트에 의해 인스턴스화된 새로운 GameObjects가 대상으로 사용되는 씬입니다.
<예제>
using UnityEngine;
using UnityEngine.SceneManagement;
public class GetActiveSceneExample : MonoBehaviour
{
void Start()
{
Scene scene = SceneManager.GetActiveScene();
Debug.Log("Active scene is '" + scene.name + "'.");
}
}
Transform.GetChild(i)
파라미터
index 반환할 자식 변환의 인덱스입니다. Transform.childCount보다 작아야 합니다.
반환
Transform 인덱스에 있는 자식의 Transform
설명
인덱스로 변환 자식을 반환합니다.
<예제>
using UnityEngine;
using System.Collections;
public class ExampleClass : MonoBehaviour
{
public Transform meeple;
public GameObject grandChild;
public void Example()
{
//Assigns the transform of the first child of the Game Object this script is attached to.
meeple = this.gameObject.transform.GetChild(0);
//Assigns the first child of the first child of the Game Object this script is attached to.
grandChild = this.gameObject.transform.GetChild(0).GetChild(0).gameObject;
}
}
'소프트웨어 공학 > 코딩' 카테고리의 다른 글
| C# 한정자 총 정리 (0) | 2025.01.31 |
|---|---|
| C# ConsoleKeyInfo 구조체(feat. Read(), SetCursorPosition()) (0) | 2025.01.27 |
| Math.Ceiling 메서드 (0) | 2025.01.21 |
| 유니티 Sprite Masks 컴포넌트 (0) | 2025.01.21 |
| C# Array.Copy 메소드 (0) | 2025.01.16 |