Hello Everyone,
This is my first question on the unity answer forums and I’ve been playing around with unity for a while but the new UI features are causing some problems for me.
I am working on a game where there is a unit roster list, player clicks a button and a new unit is added to the roster. The unit is a empty game object which when constructed (should) create a child button object which players can click to access the class. The problem is that Unity.UI.Button.Button() cannot be reached because of its protection level. Here is my code when a unit is created
class BattalionUnit{
GameObject battalion;
public Button battalionButton;
string battalionName { get; set;}
public BattalionUnit(string battalionName, Vector3 setposition)
{
battalion = new GameObject(battalionName);
battalion.transform.parent = GameObject.FindGameObjectWithTag ("Canvas").transform;
battalionButton = new Button ();
battalionButton.transform.parent = battalion.transform;
battalion.transform.position = setposition;
}