playMaker

Author Topic: NGUI Integration (WIP) [NGUI 3.5.9 supported]  (Read 109185 times)

mrbdrm

  • Playmaker Newbie
  • *
  • Posts: 39
    • View Profile
Re: NGUI Integration (WIP)
« Reply #45 on: July 09, 2012, 12:16:27 PM »
Thank you for the info :)
i already know that it uses another camera ,
what i have now is some game objects that i place with the gui camera and i cant raycast to them .
but i guess we need to look more into the examples .

mrbdrm

  • Playmaker Newbie
  • *
  • Posts: 39
    • View Profile
Re: NGUI Integration (WIP)
« Reply #46 on: July 09, 2012, 12:23:04 PM »
sorry for the double post .
try SetMainCamera action

artician

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 298
    • View Profile
Re: NGUI Integration (WIP)
« Reply #47 on: July 27, 2012, 03:42:53 PM »
Thanks for this.  It's helped my work out a great deal. 


amaranth

  • Full Member
  • ***
  • Posts: 172
    • View Profile
Re: NGUI Integration (WIP)
« Reply #48 on: August 10, 2012, 05:46:05 PM »
Is there some way to determine which NGUI component sent the event to a FSM?  

*edit* Figured out a way. I attached a FSM to the component. Then used the script to send an event to the same component. From there I can forward both the event and the Object reference to the Controller FSM.  Convoluted, but works.

I've run into this same problem, but I've found that putting 1 FSM on each button in a menu with 100 button causes serious lag, even if all FSMs are turned off. Is there a way that we can reference a FSM that is not on the same button that contains the UIEvents to PlayMaker FSM script?

Currently, when I attach "UIEvents to PlayMaker FSM" script to a button, and link it to my GameManager FSM on another game object, nothing happens.

[UPDATE]
I found the problem. When you attach the game object that contains the FSM to the "UIEvents to PlayMaker FSM", the first FSM is always referenced. There is no way to tell the script which FSM on the game object you want to reference.

Is there any possibility that an update can be added to the "UIEvents to PlayMaker FSM" script so that we can select a specific FSM, not just the first one on the game object?
« Last Edit: August 10, 2012, 06:24:11 PM by amaranth »

refinedgames

  • Playmaker Newbie
  • *
  • Posts: 16
    • View Profile
Re: NGUI Integration (WIP)
« Reply #49 on: September 07, 2012, 10:37:57 AM »
"There is no way to tell the script which FSM on the game object you want to reference. "

It is pretty simple though a little tedious.  Select the Object with "UIEvents to Playmaker FSM" script, then lock the Inspector (right click on Tab).  Open a 2nd Inspector tab in different window, and select the Object with FSMs.  Then drag the correct FSM component into the "Target FSM" slot of your button.  Works like a charm!

Sjones

  • Full Member
  • ***
  • Posts: 201
    • View Profile
Re: NGUI Integration (WIP)
« Reply #50 on: September 18, 2012, 04:16:39 AM »
is there a way to use the "call when finished" on the animation scripts to send a fsm event?

for example if a button has pressed, after its animation has played from ngui it triggers an event on the active state in a specific fsm.

JumpDog

  • Playmaker Newbie
  • *
  • Posts: 3
    • View Profile
Re: NGUI Integration (WIP)
« Reply #51 on: September 18, 2012, 11:10:20 PM »
I'm trying to figure out a way to detect an OnPress(up/released). Or possibly a way to check an NGUI button's isDown bool variable. Can't seem to find "isDown" anywhere in GetProperty for the UIButton. The post in the preceding page by alternativee30 seemed promising but I'm having a strange problem with that approach: Clicking/unclicking does indeed toggle, but for some reason, pressing/unpressing will fire the OnPress event twice, effectively keeping the FSM at its current state. I've been trying to figure this out for a while, I've scripted plenty of NGUI buttons but can't seem to get it to work with PlayMaker. Any help's appreciated!

Sjones

  • Full Member
  • ***
  • Posts: 201
    • View Profile
Re: NGUI Integration (WIP)
« Reply #52 on: September 19, 2012, 01:04:41 AM »
the first post explains how to do that, u need the script that has been made and attach it to the button, this will alert playmaker on these functions.

JumpDog

  • Playmaker Newbie
  • *
  • Posts: 3
    • View Profile
Re: NGUI Integration (WIP)
« Reply #53 on: September 19, 2012, 01:51:05 AM »
Sorry thought it was obvious that I was using that script since I was talking about using the events. The problem is on touch input for the button it fires the event twice, but on mouse click input it only fires it once (as desired).

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14593
  • Official Playmaker Support
    • View Profile
Re: NGUI Integration (WIP)
« Reply #54 on: September 19, 2012, 11:02:48 PM »
Hi,

 I know for sure that ezgui has a similar problem, due to some internals of Unity, and I had to implement a flag and a timer to prevent the second event to do anything.

 it might the case with ngui. You should contact ngui and ask if they have problems with double detection of mouse/touch input.

bye,

 Jean

artician

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 298
    • View Profile
Re: NGUI Integration (WIP)
« Reply #55 on: September 20, 2012, 12:08:05 AM »
would anyone know how i would deal with the popup list,i dont actually have individual colliders for different buttons it generates,it also generates the buttons at run time,


thanks
+1

+1 here as well.  Was there ever any movement on this?  I am using popup Menus and don't see a way to retrieve the selected item.
Thanks!

artician

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 298
    • View Profile
Re: NGUI Integration (WIP)
« Reply #56 on: September 20, 2012, 07:19:19 PM »
Cool! NGUI users please post requests for actions so we can prioritize the work.. Thanks!

In addition to the Popup Menu/List interaction, I'd love a way to create NGUI elements during runtime.

rollingdjs

  • Playmaker Newbie
  • *
  • Posts: 8
    • View Profile
Re: NGUI Integration (WIP)
« Reply #57 on: October 17, 2012, 08:35:17 PM »
would also love to know how to separate popup list events to send to fsm. seems easy enough but an answer is totally eluding me

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14593
  • Official Playmaker Support
    • View Profile
Re: NGUI Integration (WIP)
« Reply #58 on: October 17, 2012, 10:03:50 PM »
Hi,

 Such popup list and drop down are actually quite serious to implement if you ant it to be done right and behaving like we are use to. So not trivial I am afraid, especially if you want to design it at runtime.

 I would go for prefabs at the moment, building your UI component using prefab and then instantiate it
as for the actual popup content, ArrayMaker to the rescue :)

If you can set the text value of a nGui component already, then you have all the building blocks to play around with this.

like with all these components, the key to achieve something when you don't know where to start is to define the specifications. Write a document explananing with as little word as you can the mechanism, and you will then be able to extract the various internal feature of it. Then you cut down the work in small chunck

-- Can I inject a text in a ngui label component with playmaker
-- Can I create that text at runtime using a prefab and maybe a fsm inside it so I can simply fire an event to it with a string in the event data so that the text gameObject itself inject this text in the gui label.
-- can I manage a given number of text field.
-- Creating and removing items on demand based on the content of an ArrayMaker List of or hashtable

etc etc

Each if these smaller feature are easier to tackle because precise. Once you have them all covered, you put that together and shape your final UI component.

Go through this process, if you are having problem down the road, I'll make a working example. I never provided anything with nGUI yet, so it could be a starting point as many of you do use nGUI.

bye,

 Jean

Sjones

  • Full Member
  • ***
  • Posts: 201
    • View Profile
Re: NGUI Integration (WIP)
« Reply #59 on: October 24, 2012, 09:51:36 AM »
I have been experimenting and making a lot of headway with ngui of late, though I have came upon a problem with ngui that I may be able to solve with manual control using playmaker, however playmaker doesn't have an action for it yet. (I have posted on the ngui forums but not sure what they are like over there for implementing ideas etc.)

I would like to set the play direction of a UIbutton animation script (and others that use this field), the set properties has most of the other properties in that script but doesn't give access to this one, I can change it at run time through the editor so I believe it should be possible with playmaker.