Forum rules - please read before posting.

Send UI event to button from object in scene

Hi, so I have a tracked controller I'm using (virtual reality again). It appears in the game as a gameobject that moves around in 3D space. I want to be able to use it to select UI and hotspot elements. I'm currently using playmaker to raycast from it, I'm able to detect the UI element, and send a message to it when I press a button, but I'm not able to get the UI element to register a 'click', I've tried using playmakers "Send Message" action to the object, sending- OnClick, OnPointerClick, and tried sending both after sending OnPointerEnter, I've also tried those with () after them, and attaching the paramater 'bool - true'.

I understand Adventure Creator acts as a layer over the UI (I'm using Unity UI in scene), so can you give me some guidance about what message to send, or if you can think of a better way to trigger a UI action when a 3D object is raycasting at the UI in the game.

Thanks!

Comments

  • I'll admit this area isn't really my expertise, but I would've thought it'd already work.  When AC begins, it simply adds "OnClick" events to the UI buttons automatically - so if those events are triggered normally, they ought to respond.

    The code that performs this is in MenuButton.cs, line 193-5.  The OnClick event actually runs the class's ProcessClick function, which handles the click on the AC side.  However, since this class isn't a MonoBehaviour, I'm not sure you can just send a message to it like you would any other.

    I think the issue lies in getting the UI button to respond normally - AC will handle the click once it's been detected.  I recommend focusing on getting a non-AC event to trigger when pressing a button - once that's working, I believe AC will then work for you also.
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.