playMaker

Author Topic: UI Button[SOLVED]  (Read 13303 times)

VascBogdan

  • Full Member
  • ***
  • Posts: 118
UI Button[SOLVED]
« on: February 24, 2015, 11:53:21 AM »
Is there a way to send an event when an UI Button or Image is clicked/touched ? I used Mouse Pick Event on an image in the scene (a sprite) and it worked, but is there a way for an UI ?
« Last Edit: March 02, 2015, 11:28:54 AM by jeanfabre »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Button
« Reply #1 on: February 24, 2015, 12:07:37 PM »
Hi,

 Yes, you can get the PlayMaker UI support here:

https://hutonggames.fogbugz.com/default.asp?W1192

you'll find videos and samples to go along and explain how it works. I am also working on a raw PointerInfo system which will allow you to implement dragging and access to down, up exit and enter pointer events.

 Bye,

 Jean

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Button
« Reply #2 on: February 24, 2015, 12:14:22 PM »
Alternatively you can also use the built in functionality. I've been messing with it lately and it works pretty well. OnClick is already included by default for Button components, you can see it there at the bottom of the Button Component where it says "On Click ()".

Here's how you can use that:
  • Hit the + sign to add a new trigger for it
  • Drag the GameObject with the FSM you want to send the event to
  • Choose PlayMakerFSM.SendEvent from the dropdown
  • Type the name of the event to send

If you want to use the built in event system for other events you must add a Event Trigger component (this is part of the new Unity UI Event System) and the prompt is similar, you only need to choose which trigger type to fire on... ie Hover, Pressed, Released, etc...

So there are actually several options available to you =)
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

VascBogdan

  • Full Member
  • ***
  • Posts: 118
Re: Button
« Reply #3 on: February 25, 2015, 09:40:29 AM »
Sorry I'm late.

I will try Lane's thing first, because in my past I worked with OnClick() a lot so I may know how to use it. If I can't make it work I will try Jean's ideea.
Thank's !

Edit: It worked with the OnClick() :).
« Last Edit: February 25, 2015, 11:32:14 AM by VascBogdan »

ETGgames

  • Junior Playmaker
  • **
  • Posts: 56
    • ETGgames
Re: UI Button[SOLVED]
« Reply #4 on: August 06, 2015, 10:56:27 AM »
OMG THANK YOU LANE U HERO!!!! How is this the only place on THE INTERNET that has this critical instruction? Ive been searching for days and gave up by creating an invisible cube as my button XD THANKS LANE!!!  ;D ;D ;D ;D ;D

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: UI Button[SOLVED]
« Reply #5 on: August 06, 2015, 11:28:51 AM »
Horray!  ;D

It is a little hard to find, probably because it's not a part of Playmaker, but rather a feature of Unity UI. So you have to study UI which has scripting stuff tied into the tutorials almost always and thats probably a deterrent for Playmaker users but there's actually a lot of information on the inspector tools alone.

Unity's UI and Event system has a pretty legit front end, though. It's worth digging around in.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

ETGgames

  • Junior Playmaker
  • **
  • Posts: 56
    • ETGgames
Re: UI Button[SOLVED]
« Reply #6 on: August 06, 2015, 03:49:40 PM »
Thanks for the advice I will take it on board!  ;D

nikosurfing

  • Playmaker Newbie
  • *
  • Posts: 11
Re: UI Button[SOLVED]
« Reply #7 on: June 15, 2016, 02:59:52 AM »
OMG!! Thank you for this