Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

PlayMaker NGUI Scripts

Discussion in 'Assets and Asset Store' started by merlin981, Jul 26, 2013.

  1. merlin981

    merlin981

    Joined:
    Apr 16, 2012
    Posts:
    305
    My first guess is that NGUI 3 has a new event name for slider change. If this is true, then I will need to add a handler for the new event. I'll take a look at it tomorrow to see if I can get it working for you.
     
  2. merlin981

    merlin981

    Joined:
    Apr 16, 2012
    Posts:
    305
    I've published a new version with full support for NGUI v3. It generally takes Unity about a week to approve new versions, so it should be available some time next week.

    There is a new folder with a UnityPackage inside which you will need to run only if you are using NGUI v3. This package will update all the scripts to work with NGUI v3 (instead of 2.7).

    NGUI v3 has several breaking changes, especially in how it handles certain events. I made updates to the NguiEventForwarder to handle the new events and Notify system that NGUI v3 uses.

    Please read the documentation in the new NGUI v3 folder, which will show you how to use NguiEventForwarder with NGUI's new Notify system.
     
  3. merlin981

    merlin981

    Joined:
    Apr 16, 2012
    Posts:
    305
    Wow, Unity is really on their game today! The latest update has already been approved and should be available as an update in the Asset Store, now.

    Happy coding
     
  4. foolish-frost

    foolish-frost

    Joined:
    Mar 18, 2009
    Posts:
    169
    Fix seems to be doing the job. Installation was a bit touch and go, but it always is when you're upgrading. Things get disconnected and you have to tweak them a bit.

    Now it's fine.

    I have notices I have to rework your unity scripts a bit for the latest updates, otherwise a lot of warning come in. But that took around 10 minutes, so I can't complain.

    <thumbs up> Thanks for the quick fix!
     
  5. foolish-frost

    foolish-frost

    Joined:
    Mar 18, 2009
    Posts:
    169
  6. merlin981

    merlin981

    Joined:
    Apr 16, 2012
    Posts:
    305

    Thanks very much for the positive review. If you haven't already, reviews on Unity really help me a lot. I've been trying (forever!) to get on the front page of the asset store, and every positive review helps toward that effort.

    What kind of tweaks do you have to make to the scripts? If you want to share with me (here or PM is fine), I'd be happy to update the scripts further to reduce or eliminate any rework you're having to do.

    Thanks again.
     
  7. LaralynM

    LaralynM

    Joined:
    Sep 30, 2013
    Posts:
    24
    I'm having a really strange problem. It seems like the NGUI update label action doesn't work correctly in a loop, or some other specific circumstance. I've created a small project that shows the problem.

    I created an NGUI label, then cloned and renamed it to create four of them, named Label1, Label2, etc.. Here they are in the inspector and in the game screen before running (with label1 on top):

    $Screen Shot 2013-12-23 at 12.31.48 AM.png

    There is a single PM FSM that does the following:

    Converts the loop count to a string, then builds a string of "Label" + the count, to get the name of the label that should change. It then stores the gameobject with that name.

    $Screen Shot 2013-12-23 at 12.28.40 AM.png
    $Screen Shot 2013-12-23 at 12.28.47 AM.png

    Builds a string like "I am X" where the X is the loop count, then inserts that into the stored gameobject. It then changes the name of the stored gameobject to Updated to prove it is pointing at the correct label gameobject.

    $Screen Shot 2013-12-23 at 12.28.57 AM.png

    Increments the loop.

    As you can see from the screen shot of the app running, everything works correctly--including each label gameobject having its name changed to Updated to prove the gameobject is pointing at the correct one--but only the first label's text updates.

    $Screen Shot 2013-12-23 at 12.29.16 AM.png

    It's driving me crazy--this happened in a more complex project and I can't figure out what's going on or how to fix it. It blew my mind when I was trying to troubleshoot what I thought was my own error, and I watched each label's name correctly get changed to Updated even though using the same gameobject does NOT update the label TEXT correctly.

    Can you take a look at the screen shots and see if I'm doing something wrong? I can also send the test project (it's 76 MB).

    Thanks!
     
  8. merlin981

    merlin981

    Joined:
    Apr 16, 2012
    Posts:
    305
    I think FindGameObject is not updating to the new label after the first iteration of the loop.

    You could test this to see if I'm right, by adding an action after FindGameObject that would print the Name of the GameObject (just to the console would be good enough). This way, you can see if it's printing out Label1 over an over, or if its actually printing Label1, Lable2, etc.

    If you want to share a copy of you sample project via PM, I'll be happy to take a look to make sure there isn't something else going on. However, please note I'll be out of the office until Dec 26, so I wont' be able to take a look at it until Thursday or Friday.
     
    Last edited: Dec 23, 2013
  9. LaralynM

    LaralynM

    Joined:
    Sep 30, 2013
    Posts:
    24
    That's what I thought too--that FindGameObject wasn't updating, but I think it is. The sequence goes:

    Find gameobject and store as label_gameobject
    Insert text into label label_gameobject
    Change the name of label label_gameobject to Updated

    The second step, inserting the text, always inserts into the first label. The third step, changing the name of the object, works correctly and all the labels end up named Updated even though only the first label's text was changed. It's the exact same gameobject and nothing was changed between the two steps. It's crazy!

    I'll send the project via PM. Have a great Christmas!
     
    Last edited: Dec 23, 2013
  10. merlin981

    merlin981

    Joined:
    Apr 16, 2012
    Posts:
    305
    For anyone who needs it, NGUI 2.7 can be downloaded here: http://www.tasharen.com/ngui/ngui270.unitypackage

    Previous versions of NGUI 3 included an .unitypackage with NGUI 2.7. However, the latest version of NGUI 3 has removed the package.

    Apparently Tasharen isn't supporting NGUI 2.7 any more, but has made the last package available to anyone who still needs it for their projects.
     
  11. Robert-Briscoe

    Robert-Briscoe

    Joined:
    Jul 4, 2013
    Posts:
    19
    Hi,

    I just bought your Playmaker Actions package and upon reading the documentation, it instructs me to drag and drop the prefab "Playmaker NGUI Delegates" into the scene. However upon doing so, the prefab is telling me that it's missing a script! Can you tell me which script it should be referencing? Im using the latest NGUI.

    Edit: Nevermind! It seems the package did not fully import - reimported and it's there now!
     
    Last edited: Dec 23, 2013
  12. Robert-Briscoe

    Robert-Briscoe

    Joined:
    Jul 4, 2013
    Posts:
    19
    Ok so i've hit another odd problem now, it seems that the Ngui Update Label Text Action only works once on an FSM. In my scene I have two buttons set up to change the text of a Label upon clicking them, however this only works once and then will no longer update the text upon clicking again, here's a screenshot of my setup:



    http://i.imgur.com/vnJSbry.jpg

    any idea what's going wrong?
     
  13. chirhotec

    chirhotec

    Joined:
    Mar 30, 2010
    Posts:
    47
    I'm trying to get this working for NGUI 3.x.

    When I import the 3.x compatibility package, the Playmaker NGUI Delegates prefab loses connection to its script, and the associated FSM is gone. Anyone else have this problem, or know how to fix it?

    I'm using the latest NGUI (3.0.7f3) and PlayMaker (1.7.6)

    EDIT: Just read Robert.Briscoe's post above mine. I tried reimporting the v.3 enhancements a couple of times, but it isn't fixing it. Robert, which did you reimport? The main Playmaker NGUI Scripts package, or the v.3 sub package? Reimporting the main scripts will fix it, but I'm thinking this will break the v.3 compatibility

    EDIT 2: So, I think I found a fix, but would be nice to get confirmation. To recreate the "Playmaker NGUI Delegates" prefab, do the following:
    • Select the prefab to view in the inspector
    • Remove the Missing MonoBehavior component
    • Add the "PlayMakerFSM" component
    • Set the FSM name to "NGUI PlayMaker Proxy"
    • Disable "Show State Label"
    • Next to the FSM name, select "Edit" to bring up the PlayMaker Editor. Select the Events tab in the side panel
    • Open the "Playmaker NGUI Scripts/Scripts/Helpers/NGuiPlayMakerEvents.cs" in a text editor
    • Locate the "NGuiPlayMakerEventsEnum. There should be twenty lines that look along the lines of [PlayMakerNGUI_FsmEvent("...")]
    • For each line, copy the text between the quotes and paste them into the "Add Event" input in the Events tab of the FSM.
    • Select the check mark next to each one to set them as global.
    • If you were editing an instance of the prefab, make sure you Apply the changes to the prefab
     
    Last edited: Dec 24, 2013
  14. LaralynM

    LaralynM

    Joined:
    Sep 30, 2013
    Posts:
    24
    I'm having a similar problem, Robert. In my case, a loop that should be stepping through 3 labels instead repeatedly changes the first label instead. It may be caused by the same issue.
     
  15. merlin981

    merlin981

    Joined:
    Apr 16, 2012
    Posts:
    305
    Per our PM, I'll be looking at this issue later today or tomorrow, as time permits.
     
  16. merlin981

    merlin981

    Joined:
    Apr 16, 2012
    Posts:
    305

    I'll bundle a new v3 prefab, to make sure nothing is disconnected during the v3 update.
     
  17. Robert-Briscoe

    Robert-Briscoe

    Joined:
    Jul 4, 2013
    Posts:
    19
    Glad I'm not the only one experiencing this!

    Hi Merlin, glad to hear you're looking into the issue, any updates?

    Also I have a couple of Playmaker action requests, if possible:

    - Could you make an action which alters the font size of Label Text?
    - Similarly, an action which alters the font type of a Label Text?

    This would allow me to set specific fonts for different languages (i.e. Russian, Japanese etc.) and also allow me to tweak font sizes based on screen res.
     
    Last edited: Dec 28, 2013
  18. merlin981

    merlin981

    Joined:
    Apr 16, 2012
    Posts:
    305

    Updates: I'm revamping the asset package to start with NGUI v3, and including an option to install a "downgrade" to NGUI v2.7. I should have this done in another 2-3 days. I've already resolved the issues you're experiencing, and the resolution will be included in the update.

    New Requests: I'll see what I can do to add both of these. I don't see a problem adding a font type, but to be honest, I'm having issues getting fonts to resize or scale in NGUI 3. They changed something, and now my fonts are stuck at whatever size the prefab defines.
     
  19. CodingCake

    CodingCake

    Joined:
    Nov 3, 2013
    Posts:
    4
    I also have the same issue with the latest playmaker and NGUI 3.X
    and I make sure I have open the v3 update .
    But almost not thing can run correctly (demo and prefab )
    event the basic prefab (Playmaker NGUI Delegates) still show missing script ....
    :(
    I hope author can update this package soon .
    otherwise , this package almost not use for me until I bought few days ago .
     
    Last edited: Dec 31, 2013
  20. Vaupell

    Vaupell

    Joined:
    Dec 2, 2013
    Posts:
    301
    NGUI was updated, and since then there has been issues where text Input fields dosen't work for me (anymore).
    So i guess the event forwarder needs to be updated.

    ATM its not working with the current version of NGUI. well some functions atleast.
     
  21. rockysam888

    rockysam888

    Joined:
    Jul 28, 2009
    Posts:
    650
    Hi,

    What is the advantage of using this add-on when there is an official playmaker ngui add-on?

    Thanks in advance
     
  22. merlin981

    merlin981

    Joined:
    Apr 16, 2012
    Posts:
    305
    As I mentioned above, I'm working on an update, and should have it out later this week. I'm 99% done. Actually, I'm done with updating existing stuff and just working on new requests now.
     
  23. merlin981

    merlin981

    Joined:
    Apr 16, 2012
    Posts:
    305
  24. merlin981

    merlin981

    Joined:
    Apr 16, 2012
    Posts:
    305
    Latest version has been submitted to Unity for approval, and should appear on the asset store in a few days (might take a few days because of the New Years backlog).

    This version has the following changes:
    * converted package to start with NGUI v3 (instead of NGUI v2.7)
    * updated all demos to use new features from NGUI v3
    * added new demo - Font Swap
    * added new action - NGUI Change UIFont

    NOTE: This new version should address any issues you've experienced using NGUI v3 with this package. I tested as many use cases as I could think of, and tested against the sample projects some of you were kind enough to provide me (Thank you, again).

    I cannot stress this enough - if you are upgrading an existing project, you should delete the existing "Playmaker NGUI Scripts" folder from your project, and import the new version. Yes, you'll need to re-add the "Playmaker NGUI Delegates" to each of your scenes, but with the latest changes from this release, you would probably have to do this no matter what.

    There are many breaking changes caused by NGUI v3. These issues have been addressed in this update, but prefabs and other files were changed to accomodate NGUI v3. If you do not delete the original "Playmaker NGUI Scripts" folder, you will have errors when you do the upgrade.

    If you are using this with NGUI 2.7, there is a new folder called "Scripts for NGUI 2.7". Inside this folder is a .unitypackage file. If you extract this file, it will overwrite the package folder with the scripts for NGUI 2.7.
     
    Last edited: Jan 1, 2014
  25. Vern_Shurtz

    Vern_Shurtz

    Joined:
    Mar 6, 2009
    Posts:
    264
    Just bought your NGUI Scripts for playMaker. Was having similar issues as listed above and good to see quality support in action. Look forward to the update when it hits the asset store.

    :)
     
  26. merlin981

    merlin981

    Joined:
    Apr 16, 2012
    Posts:
    305
    Thanks :D
     
  27. merlin981

    merlin981

    Joined:
    Apr 16, 2012
    Posts:
    305
    Latest version of PlayMaker NGUI Scripts (v3.0.1) has been approved and is now available in the asset store.

    Once again, please remember to delete your existing Playmaker NGUI Scripts folder first, then install the new version. If you do not delete the original folder, you will have prolems!

    If you experience any issues after the update, you can email me, PM me, or post here, and I'll be happy to help troubleshoot. (Just FYI, I will be out of the office from 1/9 to 1/14, so please be patient).
     
  28. Robert-Briscoe

    Robert-Briscoe

    Joined:
    Jul 4, 2013
    Posts:
    19
    Great!

    I have another request: with the NGUI fade out/in action, could you make the automatic disabling/enabling of the object after fading optional?

    Also, it doesn't seem to like it when I use the Find Game Object action to find and store a UI object as a variable and then set the fade to use that variable. I get this error:
     
  29. Robert-Briscoe

    Robert-Briscoe

    Joined:
    Jul 4, 2013
    Posts:
    19
    Ah nuts! I just updated to the latest actions and saw that NGUI fade no longer works at all :( that's a shame as it was a really useful action
     
  30. murteas

    murteas

    Joined:
    Feb 14, 2012
    Posts:
    62
    Is there a way to get the popup list value. I can add popup list items, and I can transition on the selection changed event, but I don't see a way to get the selection value.. am I missing something obvious?
     
  31. merlin981

    merlin981

    Joined:
    Apr 16, 2012
    Posts:
    305
    Yeah, NGUI 3.0 stopped supporting that. I'm sure there's a workaround, I just haven't had time to find it, yet.
     
  32. merlin981

    merlin981

    Joined:
    Apr 16, 2012
    Posts:
    305
    In NGUI 3.0, use UIPoplist.value
     
  33. LoneCipher

    LoneCipher

    Joined:
    Apr 3, 2013
    Posts:
    4
    I am having trouble with the 'NGUI Get Slider Value' action. Is this action working in the newest version of NGUI?
     
  34. mweyna

    mweyna

    Joined:
    May 23, 2013
    Posts:
    13
    Is there a way to Update a "UITexture" - "Texture" If I want to have a button play an "Activate" state? Also, in the latest version of everything I can't see to find the CUSTOM ACTIONS as detailed in the Documentation, were those removed?
     
  35. merlin981

    merlin981

    Joined:
    Apr 16, 2012
    Posts:
    305
    Are you use the latest version of the "PlayMaker NGUI Scripts" package? NGUI v3 changed the property it stores the slider value into.

    If you don't have the latest version of the scripts package, then you're probably still reading from the old deprecated property.
     
  36. merlin981

    merlin981

    Joined:
    Apr 16, 2012
    Posts:
    305

    I will add an action to change UITextures. Thanks for the suggestion.

    Did you make sure to add the "Playmaker NGUI Delegates" prefab to the scene? This is where the custom actions are defined.
     
  37. mweyna

    mweyna

    Joined:
    May 23, 2013
    Posts:
    13
    So adding that prefab definitely fixed the custom event issue. However, I still can't seem to figure out the proper workflow in my FSM to detect and change the UITexture. Any suggestion as to how to set up my GUI buttons so that I can interact with them?
     
  38. merlin981

    merlin981

    Joined:
    Apr 16, 2012
    Posts:
    305
    Glad you got it working.

    I will add UITexture swapping to the next version, which should be out in roughly a week
     
  39. LoneCipher

    LoneCipher

    Joined:
    Apr 3, 2013
    Posts:
    4
    Thank you for the quick reply.
    I am running version 3.0.1. The game object has a uiSprite and a UIProgress bar script on it. I attached an FSM to the game object with 2 states: 'NGUI Get Slider Value' and 'NGUI Scrollbar Get Value'. Both are set to Use Owner and they each have a float variable to store the value. They are set to update every frame. I am adjusting the slider in the UIProgressbar script named 'Value'.
     
  40. merlin981

    merlin981

    Joined:
    Apr 16, 2012
    Posts:
    305
    Two things:
    1) NGUI Scrollbar Get Value won't work on a UIProgress bar
    2) Did you set the "On Value Change > Notify" property of the UISlider to point to "NguiEventForwarder.OnSliderChange"? This is one of the many changes caused by NGUI v3. I included a new documentation file in the project explaining how to set these up.
     
  41. LoneCipher

    LoneCipher

    Joined:
    Apr 3, 2013
    Posts:
    4
    Thank you for the information. I followed your documentation. I must have made a couple of mistakes. Here is what i have:
    Created a new UI Rood (3D)
    Create a sprite
    Attach the UIProgress bar scrupt and set the foeground property to the sprite script
    Attach the Ngui Event Forwarder script and set it in the on value change field with the method of NguiEventForwarder.OnSliderChange
    Attach a new FSM with the Ngui Get Slider Value action (every frame)
    Set the FSM in the Target FSM fieild of the Ngui Event Forwarder script

    To test i am adjusting the Value slider in the UIProgress bar and watching the variable. The variable stays at 0.

    Thank you for your help.
     
  42. merlin981

    merlin981

    Joined:
    Apr 16, 2012
    Posts:
    305
    Two things:

    first, you don't have to set Target FSM if the FSM is on the same object as the event forwarder

    Second, there is a demo scene (Demo > Demo Scene) which has both slider and progressbars set up doing exactly what you want. Take a look at the demo and compare with your scene.

    If you still haven't got it working, you can send me a PM with a link to your source code and I'll take a look for you
     
  43. LaralynM

    LaralynM

    Joined:
    Sep 30, 2013
    Posts:
    24
    With the current version of the scripts, the prefab is still importing without the script attached. Is this fixed in the next update? Thanks!
     
  44. merlin981

    merlin981

    Joined:
    Apr 16, 2012
    Posts:
    305
    Hi LaralynM,

    I just tested on my end, but I'm not able to reproduce your problem. I fixed that issue (or thought I did ??) with version 3.0.1 (the previous release).

    Attached is an export of only the prefab. I tested this on a Unity 4.3.2f1 project and a Unity 3.5 project. Both had PlayMaker v1.7.5 and NGUI v3.0.8 f7.

    After you have PlayMaker, NGUI, and PlayMaker NGUI Scripts installed to your Unity package, you can run the attach export to restore the prefab.

    Attached:
    View attachment $Playmaker NGUI Delegate v3.0.1.unitypackage
     
    Last edited: Jan 27, 2014
  45. Le_Foosh

    Le_Foosh

    Joined:
    Jan 5, 2014
    Posts:
    11
    $nofade.png

    Hi - apologies if this has already been sorted but I dont seem to have the fade in / out options in my NGUI dropdown?

    Could you tell me where I'm going wrong?

    Thanks!

    Kris
     
  46. merlin981

    merlin981

    Joined:
    Apr 16, 2012
    Posts:
    305
    Hi Kris,

    I made a previous post in this forum that NGUI v3 broke Fading. I deprecated the action in this package. The two scripts are still there, if you want to manually edit them (remember to remove the "obsolete" attribute).
     
  47. merlin981

    merlin981

    Joined:
    Apr 16, 2012
    Posts:
    305
    The latest version of "PlayMaker NGUI Scripts" has been published to the asset store. This version resolves an issue where some actions were not refreshing their references when "Every Frame" was checked.
     
  48. LaralynM

    LaralynM

    Joined:
    Sep 30, 2013
    Posts:
    24
    I'm having a strange problem. On one project, I can import the scripts from the store or the file you attached above, and the prefab has its script attached. On a second project, no amount of re-importing gets the prefab with a script attached--even if I delete all of the scripts and do a fresh re-import.

    Do you know why this would happen or how to fix it?

    Thanks!
     
  49. merlin981

    merlin981

    Joined:
    Apr 16, 2012
    Posts:
    305
    Unfortunately, I don't know what causes this, but it is not specific to the Playmaker NGUI Scripts package. I, too, have experienced this issue on many occasions, with various projects. I even wrote an editor script (its on the asset store), to help fix this issue - but you need to have a valid existing prefab already in the project.

    One thing you might try that sometimes works - with both projects closed, copy the file of the prefab from the good project to the one having problems. Again, sometimes this works.

    I have raised this as bug with Unity in the past, but never received a response. You might want to submit it as a bug as well. The more people who complain about it, the more likely they are to address it.
     
    Last edited: Jan 30, 2014
  50. SkermunkelStudios

    SkermunkelStudios

    Joined:
    Dec 29, 2012
    Posts:
    156
    Hi, my Playmaker NGUI Delegates Prefab seems to be missing its script, I dont know what it is called or where it is supposed to be located but it seems to be completely missing so I dont get any of the custom NGUI transitions.

    Please any help would be greatly appreciated, please respond asap!