0
Answered

Button click does not work

Noah McMoney 4 months ago in Game Creator updated by Marti (Lead Developer) 4 months ago 4

So when I put the trigger for button click, I can click anywhere on the screen and it does it’s action.

I do, when mouse clicked left do action, and I make the trigger a component for the button and the action a child of the button.


what am I doing wrong?

Unity version:
2019.3
Game Creator version:
1.1.8

1) --------------------------------

I set it up like below and it works....  Button > Trigger > Actions....

Make sure your Collider is properly sized 

2) ----------------------------------------

Also  if you used the 'Add Component' option directly on the 'Object' to add the Trigger (instead of having the trigger as a child of the object) you will need to check 'Is Trigger' option on the Objects 'Collider'

3) ------------------------------------

Unless I misunderstood, and you were talking about a UI Canvas. 

In that case I would suspect you have your 'Trigger' on a 'Panel' that takes up the whole screen.

I want it like when I push a button on the screen like “solo” and then it does the action

Not sure if this is what you are looking for, but if you want to click anywhere on the screen and do an action you just need to make a button that covers the scene and attach the action to the On Click event (if you don’t want to see the button turn the albedo to 0)

After adding the action set the function to Execute()

Answered

On Left Click requires a collider to be clicked. I think that what you're looking for is the "On Mouse Down" Trigger. This detects pressing the button, but doesn't require to specify where.