Hello word
I want to instantiate an UI Element on position (Left: 0 Right:0 PosY:0 Height:75). I did created a prefab of that gameobject and used the script below.
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class InstantiateData : MonoBehaviour
{
public GameObject ChatTemplate;
public GameObject ChatList;
GameObject xChatTemplate;
public void InstatiateChat ()
{
xChatTemplate = Instantiate(ChatTemplate,transform.position,Quaternion.identity) as GameObject;
xChatTemplate.transform.parent = ChatList.gameObject.transform;
}
}
I call this InstatiateChat function with a button. When i press my button it do successfully instantiate the button unfortunately the position & scale is wrong. Any idea about how to change position & size (Left: 0 Right:0 PosY:0 Height:75) of a UI element with script
Thanks in advance & sorry for my bad english