- Home /
Question by
maw0041 · Oct 18, 2019 at 04:21 PM ·
texturelisttreeconversion
UnityEngine.Vector2 to float
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;
}
}
}
Comment
perhaps you should also mention what the problem is?
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
64k limit when convert byte[] to base64 string 1 Answer
Cannot convert float to int when only using floats (C#) 3 Answers
Why are textures disappearing when camera gets close? 1 Answer
Tree Texture Altas Size 1 Answer