本文整理汇总了C#中UnityEngine.RectTransform.SetSiblingIndex方法的典型用法代码示例。如果您正苦于以下问题:C# RectTransform.SetSiblingIndex方法的具体用法?C# RectTransform.SetSiblingIndex怎么用?C# RectTransform.SetSiblingIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.RectTransform
的用法示例。
在下文中一共展示了RectTransform.SetSiblingIndex方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddItem
public void AddItem(RectTransform item, int index)
{
item.SetParent(contentsNode, false);
item.SetSiblingIndex(index);
if (this.gameObject.activeInHierarchy)
{
StartCoroutine(SetPosition(item));
}
}
示例2: Start
public void Start()
{
panel = Instantiate(Resources.Load<GameObject>("Prefabs/UIPrefabs/ButtlePanel")).GetComponent<RectTransform>();
panel.SetParent(GameObject.Find("/Canvas").transform);
panel.sizeDelta = new Vector2();
panel.SetSiblingIndex(0);
panel.position = new Vector3(panel.rect.width / 2, panel.rect.height / 2, 0);
player = GameObject.Find("/Player").GetComponent<PlayerController>();
maxHP = player.MaxHP;
hpbar = panel.FindChild("HPPanel/HPBar").GetComponent<Slider>();
hptext = panel.FindChild("HPPanel/HPText").GetComponent<Text>();
hpbar.maxValue = maxHP;
enemyPoint = Resources.Load<GameObject>("Prefabs/UIPrefabs/EnemyPoint");
radarPanel = panel.FindChild("RadarPanel").gameObject;
playerPoint = panel.FindChild("RadarPanel/PlayerPoint").gameObject;
prtf = playerPoint.GetComponent<RectTransform>();
ptf = player.transform;
rrtf = radarPanel.GetComponent<RectTransform>();
marker = panel.FindChild("MarkerPanel").GetComponent<MarkerScript>();
maincamera = GameObject.Find("/Player/Main Camera").GetComponent<Camera>();
remainingEnemyPanel = panel.FindChild("RemainingEnemyPanel").GetComponent<RectTransform>();
remainingEnemyNumText = remainingEnemyPanel.FindChild("Text").GetComponent<Text>();
remainingEnemyPanel.localScale = Vector3.zero;
timeLimitPanel = panel.FindChild("TimeLimitPanel").GetComponent<RectTransform>();
timeLimitText = timeLimitPanel.FindChild("Text").GetComponent<Text>();
timeLimitPanel.localScale = Vector3.zero;
}