I am trying to create a script attached to a button that will simulate a treeview in ui
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Heights : MonoBehaviour
{
public RawImage right;
public RawImage down;
public Vector2 position = new Vector2(0.5f, 0.5f);
public float GetHeight()
{
Vector2 height = gameObject.transform.position;
if (right.gameObject.activeInHierarchy.Equals(true)) // if the arrow is facing right
return height;
else
{
foreach (Transform child in transform)
height += child.GetHeight();
return height;
}
}
}
↧