Hello
I'm trying to take some components inside a prefav who is a Canvas, the prefav inside have two panels and, on each one of them, inside them, have 4 buttons, i want to access this buttons to try -somehow- to add the script to the OnClick() area and then, select a function, and add a variable if the function requiere it, so the questions are simple.
How exactly i can access the panels and the buttons from C#?
And then, how can i access the OnClick() selected script area of the buttons through C#?
How can i from then get the function of that script through C#?
And how i can, after that, bring a variable valu if the functin ask for it through C#?
And also:
What are exaclty at component level the panels?, i know they (i guess/heard) can't be selected like "Panels", so the question stands, whats exactly the type of component that a panel is?, it doesn't seem in the GameObject list than there is actualy a Panel type at all.
What are they?
This is what i have so far:
Any comment, question or request for clarification will also be much apreciated.
Thanks in advance
I'm trying to take some components inside a prefav who is a Canvas, the prefav inside have two panels and, on each one of them, inside them, have 4 buttons, i want to access this buttons to try -somehow- to add the script to the OnClick() area and then, select a function, and add a variable if the function requiere it, so the questions are simple.
How exactly i can access the panels and the buttons from C#?
And then, how can i access the OnClick() selected script area of the buttons through C#?
How can i from then get the function of that script through C#?
And how i can, after that, bring a variable valu if the functin ask for it through C#?
And also:
What are exaclty at component level the panels?, i know they (i guess/heard) can't be selected like "Panels", so the question stands, whats exactly the type of component that a panel is?, it doesn't seem in the GameObject list than there is actualy a Panel type at all.
What are they?
This is what i have so far:
Code:
. . .
Canvas canvasPrefab = LoadSprite ();
canvasPrefab.name = "canvasPrefab";
Instantiate(canvasPrefab, Camera.main.transform.position, Camera.main.transform.rotation);
canvasPrefab.GetComponent (Canvas); //Not sure if this is right
. . .
Any comment, question or request for clarification will also be much apreciated.
Thanks in advance