Forum rules - please read before posting.

getting Menu name from UISlotClick ?

Hi
Is there a way that I can get the menu and menu element that a button is assigned to via the UISlotClick component? I can't see an obvious function in its declared list, other than Setup() but that seems to be the opposite, to assign that button to a menu element.

I have another component on the menu buttons in the UI, and my component needs to know which menu element each of its objects are assigned to. The only AC thing there is the UISlotClick component which is created at runtime.

Olly

Comments

  • Yes, you can do it with this:

    var canvas = gameObject.GetComponentInParent<Canvas> ();
    var menu = KickStarter.playerMenus.GetMenuWithCanvas(canvas);
    var element = menu.GetElementWithGameObject(gameObject);
    
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.