親オブジェクトが持っている子要素の順番を変更するサンプルです。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
/// <Summary> | |
/// 子要素の順番を変更するスクリプトです。 | |
/// </Summary> | |
public class SiblingTest : MonoBehaviour | |
{ | |
// 並び替える対象のゲームオブジェクトです。 | |
public GameObject targetObj; | |
void Start() | |
{ | |
// ターゲットを先頭に配置します。 | |
targetObj.transform.SetAsFirstSibling(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment