Unity Ninja Unity 3D Forum
To have exclusive access to all downloads, recourses and links within this forum, a free registered account is required. Just a heads up Wink
Go down
Member [Lv. 0]
Member [Lv. 0]
Posts : 1
Points : 891
Rep : 0
Join date : 2016-02-13
View user profile

Questions about Panels & Buttons.

on Sat Feb 13, 2016 11:28 pm

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:


. . .
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
Back to top
Permissions in this forum:
You cannot reply to topics in this forum