首页 > 编程语言 > 详细

Unity查找自身为第几个子物体GetSiblingIndex()

时间:2021-07-26 14:57:17      阅读:34      评论:0      收藏:0      [点我收藏+]

1.API  GetSiblingIndex(); Gets the sibling index

直接挂到 四个按钮上  即可看到每一个按钮的索引 (也就是Canvas下面有几个子物体 索引从0开始)

技术分享图片

 

 代码:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GetChild_ID : MonoBehaviour
{
    public int IDD;
    public  Transform parent;
    // Start is called before the first frame update
    void Start()
    {
        parent = this.transform.parent;
        IDD = this.transform.GetSiblingIndex();
    }
}

 

Unity查找自身为第几个子物体GetSiblingIndex()

原文:https://www.cnblogs.com/qq2351194611/p/15060985.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!