playMaker

Author Topic: [SOLVED]Need help with NGUI and playmaker (Mouse Pick Event 2D specific issue)  (Read 4179 times)

Yonben

  • Playmaker Newbie
  • *
  • Posts: 21
Hi everyone :)

So basically, I wanted to learn more (Good!) but I got stuck (Usual) and I can't find a solution by myself (Bad!). Maybe I need to rest a little on it to ease my mind and gain some perspective on that, but anyway, asking isn't bad either.

So basically the goal is to change a NGUI label from a click on a 2D sprite.
My issue is to get the mouse click event: on the label FSM, it stays on Idle and doesn't detect my mouse down :x

Edit: posted by mistake let me finish to write it, sorry :)
Edit 2: Done :))
« Last Edit: February 07, 2014, 07:26:16 PM by Yonben »

Yonben

  • Playmaker Newbie
  • *
  • Posts: 21
Re: Need help with NGUI and playmaker (Mouse Pick Event 2D specific issue)
« Reply #1 on: February 05, 2014, 07:29:47 PM »
Edited, with the screen of my FSM (on my label) and my sprite inspector :)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Need help with NGUI and playmaker (Mouse Pick Event 2D specific issue)
« Reply #2 on: February 06, 2014, 02:48:16 AM »
Hi,

 Unity 2d is not Ngui, so given how you explain it, I think that you need toi listen to mouse event on your unity 2d sprite.

the usual "MOUSE DOWN" system event from PlayMaker will do. have an fsm on that sprite with a global transition set to "MOUSE DOWN" and that will work.

you may need the Unity 2d package if you want to do more with unity 2d tho.

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

bye,

Jean

Yonben

  • Playmaker Newbie
  • *
  • Posts: 21
Re: Need help with NGUI and playmaker (Mouse Pick Event 2D specific issue)
« Reply #3 on: February 06, 2014, 04:26:59 AM »
Sorry I forgot to add my States. I already used the Unity 2D package. And tried with both global and normal transition. The issue is obviously the click detection as my FSM stays stuck on Idle state even when clicking ^^.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Need help with NGUI and playmaker (Mouse Pick Event 2D specific issue)
« Reply #4 on: February 06, 2014, 04:30:00 AM »
Hi,

 As I said, simply add a global transition to your second state and point to "MOUSE DOWN" global system event. that will do.

bye,

 Jean

Yonben

  • Playmaker Newbie
  • *
  • Posts: 21
Re: Need help with NGUI and playmaker (Mouse Pick Event 2D specific issue)
« Reply #5 on: February 06, 2014, 04:46:51 AM »
Hi,
As I said, I tried that too, and I got the exact same result..

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Need help with NGUI and playmaker (Mouse Pick Event 2D specific issue)
« Reply #6 on: February 06, 2014, 05:20:35 AM »
Hi,

 You do have a collider on your sprite 2d right? No interaction is possible without colliders, it's true for 3d and 2d objects.

I made a small test scene to show how to properly implement mouse events, as well as touch events.

bye,

 Jean

Yonben

  • Playmaker Newbie
  • *
  • Posts: 21
Re: Need help with NGUI and playmaker (Mouse Pick Event 2D specific issue)
« Reply #7 on: February 06, 2014, 03:35:54 PM »
Uhhh, I just don't get it. You explained very well. I copied the template from your Mouse FSM, but it still doesn't get the click. I obviously added a collider, but I have to say my sprite is a UISprite, and not a sprite like in your package.
And I notice yours is a Sprite Renderer, it might be the issue ? (gonna try with Sprite Renderer and keep you up to date).

Sorry to be such a noob, but you know, trials & errors :)

Yonben

  • Playmaker Newbie
  • *
  • Posts: 21
Re: Need help with NGUI and playmaker (Mouse Pick Event 2D specific issue)
« Reply #8 on: February 06, 2014, 03:52:09 PM »
It works very well with Sprite Renderer BUT I have this weird issue where my sprite in my Scene is much more bigger than my sprite in my game. I guess is some texture renderer settings and 2D stuff, so, what can I do, I'd like to have a clean scene to work on you know :x

Yonben

  • Playmaker Newbie
  • *
  • Posts: 21
The issue is solved (and the last question was only a cameras issue, not a PM one).

Thanks!