Search Unity

[RELEASED] Score Flash: Easy to use GUI for Scores, PowerUps, Achievements, Tutorials

Discussion in 'Assets and Asset Store' started by jashan, Sep 26, 2012.

  1. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    It seems that forum notifications work again. At least the daily ones. But I'll keep monitoring this thread for a while just in case ;-)
     
  2. bocs

    bocs

    Joined:
    May 9, 2009
    Posts:
    413
    Had a quick look...found some things that may be bugs?
    *PC Unity 4.1.0f4

    1. Layout only works correctly if scene is in ISO mode...bug or normal?
    In Perspective, Buttons draw over Scene Tab
    *They can be clicked...have to have cursor below buttons
    *obvious it's not offsetting from the Tab and Toolbar height in Perspective

    2. Layout stays on screen after you delete object with ScoreFlashLayout (with error)
    Repro: add empty obj, add ScoreFlashLayout, delete obj
    only way to get the layout to remove is go into play mode and back to clear it

    Nothing Critical...

    Screen Shot that shows both things.....
    http://img.ctrlv.in/5148812809c81.jpg
     
  3. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    Thank you for reporting these issues!

    This actually looks a little like a bug in Unity to me - but maybe I can still work around it. When you're using UnityGUI, Iso / Perspective should definitely not matter. I've done most of the development using Perspective - but maybe it's something that only occurs on Windows. I'm doing development on the Mac and only some testing on Windows ... and I obviously missed that specific case. So I really appreciate you bringing this to my attention.

    One issue I'm aware of is that Unity reports wrong Screen.height values when drawing into the SceneView. I actually had to do some pretty intense changes to work around that issue. What you're seeing might be related to that and I wanted to create a nice little repro project for UT for that anways. Maybe I can include what you're seeing into that as well (and once I understand exactly what's going on, most likely I will be able to create a work around).

    That's another thing I'll have to look into more deeply. The type cast exception is in line 15 of ScoreFlashEditorBase - that information will be very helpful in reproducing / fixing that issue.
     
  4. fadzuli

    fadzuli

    Joined:
    Sep 22, 2010
    Posts:
    15
    Hi Jashan

    The positions of score flash text is not correct when I set the UIRoot to FixedSizeOnMobiles scaling style. This is reproducible in the Scoreflash NGUI demo project, switching to mobile build and changing the resolutions in the editor. I have also deployed on actual devices. Am I missing a setup or is this a bug?
     
  5. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    Currently, this is "by design". It's also mentioned in the PDF that comes with the NGUI ScoreFlash integration:

    The reason is because ScoreFlash is designed for pixel perfect. So, the intended approach e.g. for using Retina would be to use NGUIs Reference Atlas / Font types for a standard density and high density version; and have ScoreFlash automatically scale the coordinates x2 (this is built into ScoreFlash).

    That said ... I can see that with the advanced layout features that ScoreFlash 3.1 has, even if you could have a separate UIRoot with PixelPerfect for ScoreFlash, this may limit the way you set up your GUI. So I'm looking into extending the NGUI integration to also support alternative scalings.
     
  6. crafTDev

    crafTDev

    Joined:
    Nov 5, 2008
    Posts:
    1,820
    Hey, I haven't been keeping up. But I've read the updates and I'm not sure if you've implemented what I wanted for score flash yet? Like one to show scores being updated?
     
  7. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    Hey there, nice to hear from you! Yeah, I think everything you requested should be implemented in the last version. It took me much longer than I had anticipated because I also added a visual designer for the layouts ...

    Did you check out the "video release notes"?

     
  8. eriihine2

    eriihine2

    Joined:
    Mar 16, 2013
    Posts:
    8
    Has anyone tried to use scoreflash PlayMaker actions (e.g. ScoreFlashPush action) in PlayMaker sub-fsm ?

    I was not able to get this to work. It seems that action is called properly (confirmed by setting up a breakpoint in ScoreFlashPush action c# script), but the scoreflash message is not visible on the screen.

    I'm not sure if this is an ScoreFlash or PlayMaker issue, but since the ScoreFlashPush-action was called properly I wager it might be a problem in ScoreFlash (?) Message was displayed correctly when the same action was called from the main PlayMaker FSM.
     
  9. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    Does that ScoreFlash instance correctly show its messages when you activate Autogenerate Messages (under Testing)? Since it seemingly works in the main PlayMaker FSM I'd assume that this is the case ... so it's very weird that it doesn't work in the sub-fsm.

    Can you post a screenshot of how you've set up the Action? Those would be the first two things I'd check into.

    I'll try to reproduce the issue also on my system - feel free to also contact me on Skype via jashanchittesh if you need immediate support.
     
  10. eriihine2

    eriihine2

    Joined:
    Mar 16, 2013
    Posts:
    8
    I created a small test project where this problem is visible. Send you the link via pm.
     
  11. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    Thank you for bringing this issue to my attention - and thank you very much for the repro-project. It took me a while to figure this one out and in the end, it turned out that this isn't related to ScoreFlash but an issue with templates in PlayMaker (I had already communicated this via private message but this is in case someone else runs into the same issue):

    The PlayMaker templates are stored in a file in the project. And when you close and re-open the project, you'll see that any references you've had into the scene are gone (I noticed that when I created a repro-project for the PlayMaker-guys ... which didn't even use ScoreFlash but just a super-simple set up).

    So, the behavior that you were experiencing was that when you were having a reference to the ScoreFlash instance in the playmaker action, that reference was actually not pointing to the ScoreFlash instance in the scene ... but a zombie-ScoreFlash-instance in some Nirvana-like reality.

    We're lucky the universe didn't collapse ;-)

    Anyways, so what happened was that this zombie-ScoreFlash-instance actually did receive the message - but it never displayed it because it wasn't really living in Unity anymore.

    That was an issue that I could work around ... but the workaround would create potential other problems. And worse: It would only work until you close and re-open the project. Then, PlayMaker forgot you set the reference. Ironically, in your specific case, it actually makes the message be shown again (because ScoreFlash falls back to ScoreFlash.Instance when no specific instance is assigned in the action ... which is kind of the usual case for most people anyways). However, it's not shown by the instance you specified but just any instance.

    I've filed a bug with Hutongames, that's Case 671 .. and also posted to their forums:

    Problem with Object reference, Sub-FSM and custom action

    They seem to react pretty quickly and I've sent them a barebones repro-project ... so I'd hope they fix this issue fairly soon. But it might not be that trivial, so don't hold your breath. Whenever I get an update on this, I'll also post here.

    That was quite an interesting journey (I literally didn't believe my eyes for a little while when the message miraculously "disappeared" - the funny thing is that the "zombie-object" has the same name, and also the same InstanceID as the living one in the scene ... so it's probably also kind of an oddity with Unity that this would happen).
     
  12. crafTDev

    crafTDev

    Joined:
    Nov 5, 2008
    Posts:
    1,820
    Saw the updates jashan! :)

    Having problem; EZGUICustomRenderer cant find the scripts that are supposed to be on it jashan. I tried reimporting but that doesnt work...

    Edit: I figured out the scripts that were missing (EZGUI's SpriteText and EZScreenPlacement)
     
    Last edited: Apr 18, 2013
  13. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    Yeah ... you have to make sure that all of EZ GUI is imported. It works also if you re-import EZ GUI later but it's best to have it right there ;-)

    Also: When updating ScoreFlash you have to import the packages that you're using (for NGUI integration, or EZ GUI, or PlayMaker) to make sure that those are also updated. Unfortunately, I can't make this easier because I can't rely on the other packages to be available. So, when using those packages, it's a two step process:

    a) Update ScoreFlash (as you would update any other packages)
    b) Double click the "extension packages" to import their most current version into your project (this only applies to you when using NGUI, EZ GUI and PlayMaker)
     
  14. crafTDev

    crafTDev

    Joined:
    Nov 5, 2008
    Posts:
    1,820
    jashan I have another problem. When adding an EZGUIRenderer script do I have to keep the renderer in the scene? I have a specific camera that I allow the HUD to be shown through (not the main camera) and I can't set this camera when the renderer object is not in the scene.

    Also, how do I change size of font?

    EDIT: Realized that score flash auto sets font to pixel perfect and then set that to false since i dont need pixel perfect.
     
    Last edited: Apr 18, 2013
  15. crafTDev

    crafTDev

    Joined:
    Nov 5, 2008
    Posts:
    1,820
    Sorry for the 50 questions today jashan, but I want to be able to use ScoreFlash to control a sprite object. With the new update you said it can be done since you did the achievement examples. What I would like is a simple tutorial of where to start.
     
  16. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    You mean ScoreFlashRendererEZGUI? Or, in other words, the game object that has the component inheriting from ScoreFlashRendererBase attached? No, you don't need to keep that in the scene.

    Ah ... for this purpose, you might have to extend ScoreFlashRendererEZGUI to pick up that camera and set it according to your needs. Let me know if you need help with that (it may actually make sense to provide a generic way to do this ... and this doesn't look trivial ... but that may be because it's very late over here and I'm pretty tired ;-) ).

    In general, I'd recommend creating the font according to your needs. In other words: Bake it into the atlas in the size that you need.

    I hope that won't confuse the positioning algorithms. It depends a little on what you need, so this may not be a problem for you at all - but I'd be cautious with "non-pixel-perfect" because ScoreFlash is very much pixel-based. Please let me know if you're encountering any issues!
     
  17. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    I see ... I'll extend the package with an example for an achievement like I did for UnityGUI and NGUI tomorrow. That should help get you started.

    Basically, what you need to do is set up "the whole thing" as one big prefab, in other words, the background, and and texts you need, and all that. In most cases, you'll probably want to have a fixed size (unless you find a good way to dynamically let EZ GUI calculate the correct size for you). Then, you need to hook up any parameters (e.g. different texts) so that you can set those for a new instance of the prefab and the new data will be shown by EZ GUI (pass through the values to the relevant EZ GUI widgets). Finally, when "pushing an achievement", you use your custom class which inherits from ScoreFlashRendererBase, "configure" it as you need it (set all the relevant values as you need it), and then pass it to ScoreFlash instead of the text as you usually would.

    It's not as easy as just pushing a text string, of course - but with this, you should be able to do pretty much anything (I have on example where I actually use ScoreFlash to create a kind of context menu ;-) ).
     
  18. crafTDev

    crafTDev

    Joined:
    Nov 5, 2008
    Posts:
    1,820
    OK so create the size I want it my font creator and turn back on pixel perfect then...
    I basically want to send a visual pick up sprite when the player picks an item up.
     
  19. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    Yeah, that will probably give you the best results. Are you supporting both standard-density and high-density (Retina) displays? I'm not sure if there's some sort of built-in support for that in EZ GUI. If not, I might need to still extend ScoreFlash (it does this when using UnityGUI, and NGUI has its own solution ... but with EZ GUI, I'm not sure how to best do this).

    Is that sprite just an image? Or an image with text? If it's just an image, that should then be very easy :)
     
  20. crafTDev

    crafTDev

    Joined:
    Nov 5, 2008
    Posts:
    1,820
    Just an image. So if it is easy I will gladly appreciate help in trying to get it to work.

    EZGUI doesn't have built in standard and high density support. So it would be great if you ended up supporting this.

    Also, can make another feature request? I realized that you only have rotation in the fade out phase. Would you be able to add rotation in the fadein and read phases too?

    Thanks.
     
    Last edited: Apr 20, 2013
  21. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    Ok, I'll create a little demo for you ;-)

    I'll have to look into that; it'll definitely require some more involved set up on your side. But I can probably do is create a custom renderer that switches between two labels depending on whether you're on a high-density device or not. Then all you will have to do is to set up the two labels correctly (probably by having an atlas with both fonts; or having two different atlases).

    That's a nice idea ... will be in the next version :)
     
  22. crafTDev

    crafTDev

    Joined:
    Nov 5, 2008
    Posts:
    1,820
    Any updates on the demo jashan?
     
  23. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    Hi jrDev, I'll send you a package with the demo tomorrow. I'm sorry I didn't get this to you earlier - I've been having a pretty crazy week.
     
  24. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    I hope you also have SpriteManager 2 ... because it seems that with EZ GUI alone, it's not possible to just create a simple image-sprite :-(

    So, here's two links pointing to the same package. This requires that you also have SpriteManager 2 installed - EZ GUI alone won't do for this, so this probably won't go into the official release of ScoreFlash. One "hack" you could probably use is instead of using PackedSprite (which comes with SpriteManager 2), you could use some button (of which a few come with EZ GUI).

    Here's the two links:

    ScoreFlashRendererEZGUI-Package.unitypackage
    ScoreFlashRendererEZGUI-Package.unitypackage.zip

    After putting the package into a project that has all three EZ GUI, SpriteManager 2 and ScoreFlash included, look for EZ GUI-ScoreFlash / Example3-SimpleRenderer. This is using EZ GUI-ScoreFlash / SimpleRendererEZGUI.cs and the related prefab.

    Please let me know how this works for you!
     
    Last edited: Apr 25, 2013
  25. crafTDev

    crafTDev

    Joined:
    Nov 5, 2008
    Posts:
    1,820
    No problem, I have both :)
     
  26. Deepestblue

    Deepestblue

    Joined:
    May 11, 2009
    Posts:
    48
    Hi there Jashan,

    first of all thanks for this great package and all the work that went into it! :)

    I have a slight problem and hope it's just because I am missing something: I have a scene with several GameObjects that have the Follow3D component attached and setup. They also have a custom script from myself which periodically sends a "ScoreFlash.Instance.PushWorld(compScoreFlash3D, Random.Range(1, 20));". There is only one ScoreFlash instance in the scene, and I use the custom renderer for NGUI (but the following effect is the same with the other renderers too.)

    At first glance everything works like a charm and as expected/documented, but when I turn my character/camera (firstperson via Ultimate FPS Camera) around, I see that the output of ScoreFlash is additionally projected on the opposite side (vector3-mirrored relative to my position from the actual Follow3D-targets). Having looked for a couple of hours I am out of ideas and thought I'd at least ask if anybody has encountered a similar problem or if you'd have an idea what I can try out?

    Thanks a lot!

    (P.S.: I use the ScoreFlashRendererNGUI prefab as "ScoreFlash Renderer" and a dedicated panel ("ScoreFLashPanel") at my main NGUI anchor as Custom Parent for Renderer. ScoreFlashPanel holds a label with the ScoreFlashRendererNGUI-script as component. From what I coudl read up that seems to be right ..?)
     
    Last edited: Apr 26, 2013
  27. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    Which version of ScoreFlash are you using? IIRC, I fixed that bug for ScoreFlash 3.1. Possibly, you might have to update the NGUI-integration by re-importing the NGUI package after updating the ScoreFlash-package.

    Sorry this reply took me so long - for some reason I seemingly didn't get the notification via email.
     
  28. Deepestblue

    Deepestblue

    Joined:
    May 11, 2009
    Posts:
    48
    Your answer didn't take long at all, thanks for coming back so quickly! :) I use NGUI 2.5.1 and ScoreFlash 3.1.0. But I can reimport everything from scratch and see if that changes anything!
     
  29. Deepestblue

    Deepestblue

    Joined:
    May 11, 2009
    Posts:
    48
    Sadly it didn't. NGUI 2.5.1 and ScoreFlash 3.1.0.
     
  30. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    Ooops. Thank you! I just realized that I was missing something important in the documentation and also forgot to assign this in my own example(s) ... which - in those specific examples - really isn't a big deal because they have static cameras. But it did confuse me now when I was doing a quick check (and manually turned the cameras by 180° on Y ;-) ):

    In 3.1, to fix that issue, I've introduced a new property to ScoreFlashFollow3D: targetRenderer ("Renderer of Target" in the inspector):

    See also: ScoreFlashFollow3D.targetRenderer Field

    So ... what's missing in the documentation is basically: If it can happen in your game that objects that have ScoreFlashFollow3D attached are behind the camera and still get messages pushed through them, make sure to assign targetRenderer with an appropriate renderer of that object (in most cases, there will only be one renderer - the one that's rendering your object ;-) ).

    I should probably automatically detect the renderer (or renderers, if there's many) as fallback if none is assigned, to make this a little easier to use. That will only work if the renderers are attached to the same object or an object below the object that ScoreFlashFollow3D is attached to, though (there's many use cases where this isn't the case and then it really only works when you manually wire it up correctly).


    While testing this, I also noticed another issue that can be a little confusing: I'm simply checking if the renderer is visible - and if you have the scene view active, and you still see the objects in the scene view, this is true; even when the objects are no longer visible in the game view. So when testing, you need to take care that you don't have the scene view active or, if you have the scene view active, that it doesn't show the objects you have the ScoreFlashFollow3D instances attached to. Theoretically, I could check the main camera, or the reference camera you have assigned in ScoreFlashFollow3D, to prevent the issue with the scene view camera ... let me know if you think that would be preferable!


    Most likely, this is the issue you're seeing. However, just to be sure: Theoretically, something similar might also occur under certain circumstances when using NGUI and you didn't activate/deactivate the correct layers to properly separate the GUI-objects from the game objects so that the GUI camera only renders the GUI-objects and the game camera only the game objects. From what you describe I don't think that's the issue (it looks much more like the issue described above) but I thought I should mention it.
     
  31. Deepestblue

    Deepestblue

    Joined:
    May 11, 2009
    Posts:
    48
    Ah excellent, thanks - that really could be it. :) As of now I haven't found the Target Renderer input field in the inspector of any component, but I'll keep looking! Hope that fixes it because otherwise your nice ScoreFlash looks awesome in my game! :)
     
  32. Deepestblue

    Deepestblue

    Joined:
    May 11, 2009
    Posts:
    48
    Hmmm, I am really sorry to still bother, but I really can't find the "targetRenderer" that you are pointing me to. None of the involved object seems to have a script attached that allows me to set "targetRenderer". ScoreFlashFollow3D, ScoreFlash.cs, ScoreFlashLayout.cs and ScoreFlashManager.cs manager also don't seem to have a variable inside that's named liked that. Would you please be so kind and point me to where I can drop my renderer into? :) Thanks!
     
  33. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    I guess a picture is worth a thousand words, you have to look for it in ScoreFlashFollow3D:

    $ScoreFlashFollow3DRendererOfTarget.png

    ... and the forum editor is a little broken - but at least in the preview, I can see it ;-)

    The name in the inspector is"Renderer of Target".

    And great to hear it's looking awesome in your game. :)
     
  34. Deepestblue

    Deepestblue

    Joined:
    May 11, 2009
    Posts:
    48
    Despite the missing picture, I found it. Sorry, Apparently I have been blind last night. :) So, I threw the Mesh Renderer of the object into it that has the ScoreFlashFollow3D attached to it, right? So far no change, the ScoreFlash still appears behind the camera. :/
     
  35. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    Weird - I'm seeing the picture. Seems like that's a problem with the forum software :-/

    Anyways ... what's even weirder is that it still doesn't work for you. Are you sure there's no scene view active where the object is still visible?

    You can also contact me via Skype - I'll be away for about 1 1/2 hours and then switch it on. My Skype handle is jashanchittesh ... I'm sure we can make this work ;-)
     
  36. Deepestblue

    Deepestblue

    Joined:
    May 11, 2009
    Posts:
    48
    Very kind, thank you, trying to contact you via Skype then! :)
     
  37. Deepestblue

    Deepestblue

    Joined:
    May 11, 2009
    Posts:
    48
    Thanks once again for the chat! Not only did you solve my problem but it was on top a really nice conversation. :) Keep up the great work and be sure I will point other developers to your great package!

    P.S.: For others using ScoreFlash with NGUI (and turning and/or multiple cameras)

    (1) always set the layers of your GUI/non-GUI objects correctly.
    (2) always set "Renderer of Target" for the object that holds "ScoreFlashFollow3D" to it's own renderer.
    (3) when being in Editor move the Scene-camera away so it does not see any objects holding "ScoreFlashFollow3D".
    (4) when using RenderTextures (e.g. for MiniMaps) make sure the objects holding "ScoreFlashFollow3D" are not being rendered by them.
     
    Last edited: Apr 27, 2013
  38. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    You're very welcome! I very much enjoyed the conversation, too, and thank you for spreading the word!!! :)
     
  39. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    This part always applies when you use ScoreFlashFollow3D and objects might be "out of your main camera":

    In the next version of ScoreFlash, there will be some improvements to this - in particular, when you assign a reference camera to ScoreFlashFollow3D, that reference camera will be used instead of simple checking that the renderer is visible (which is true when it's visible in any camera). One tricky thing about this is that if you're using ScoreFlashFollow3D on prefabs, you'll have to hook the reference camera up after instantiating those prefabs.

    There also seems to be a performance issue with ScoreFlashFollow3D, especially when on mobile, and when using it on many objects. If you can have KeepStatic checked, this might reduce the problem a little bit (but that's also a different effect, so this may not always be an option). I'll be looking into this end of this week, so there might be a new version coming up soon ;-)
     
  40. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    Here's a little update on progress on the next version, ScoreFlash V3.2:

    • Added experimental support for Catlike Coding’s TextBox
    • ScoreFlashFollow3D: When no reference camera is assigned, Camera.main is used as fallback - but when no camera with tag MainCamera is available in the scene that fallback also fails; added a more informative warning and another fallback (just grabbing any camera that’s available in the scene), so it might work even in that case but you’ll be getting warnings
    • ScoreFlashFollow3D: Instead of testing renderer.IsVisible - which will return true if the renderer is visible in any camera (scene view, minimap cameras, whatever), I’m now doing a test specific to the reference camera; this makes the mechanism to hide messages coming from objects behind the camera much more robust
    • Performance: When ScoreFlash is not enabled, messages are no longer registered
    • Performance: Fixed several places that caused GC-spikes (those were especially related to ScoreFlashFollow3D)
    Version 3.1 did introduce a few problems regarding performance, especially when using ScoreFlashFollow3D (one issue was even introduced in 3.2 - renderer.IsVisible is pretty cheap but not very reliable, the new approach is reliable but pretty costly), and there were a few issues with creating lists when creating lists wasn't really necessary. So, there was quite a bit of room for improvement - and this also shows in the numbers ;-) ... I created a test-scene which has 20 cubes each generating a message every half second. In other words: 40 messages per second, going off in bursts. If you create this many message in your game, you should definitely re-consider what you're doing - but for a performance stress-test, this is just what I needed ;-)

    So here's the results:

    TestScene “WorldSpaceMessagesLoadTest”, Device: iPhone 4S


    Unity 3.5.7: ScoreFlash 3.1

    cpu-player> min: 23.0 max: 355.6 avg: 79.1

    frametime> min: 27.8 max: 364.6 avg: 87.1
    mono-scripts> update: 14.5 fixedUpdate: 1.2 coroutines: 54.6
    mono-memory> used heap: 630784 allocated heap: 872448
    max number of collections: 2
    collection total duration: 8.0


    Editor Profiler (running in the editor):
    ScoreFlash.Update(): GC Alloc: 8.7 KB, Time ms: 1.75
    ScoreFlash.FixedUpdate(): GC Alloc: 1.1 KB, Time ms: 0.13
    ScoreFlash.OnGUI(): GC Alloc: 1.0 KB, Time ms: 1.48


    Unity 3.5.7: ScoreFlash 3.2

    cpu-player> min: 12.6 max: 46.0 avg: 21.7

    frametime> min: 18.2 max: 50.9 avg: 35.0
    mono-scripts> update: 6.2 fixedUpdate: 0.2 coroutines: 7.9
    mono-memory> used heap: 733184 allocated heap: 872448
    max number of collections: 0
    collection total duration: 0.0


    Editor Profiler (running in the editor):
    ScoreFlash.Update(): GC Alloc: 176 B, Time ms: 0.28
    ScoreFlash.FixedUpdate(): GC Alloc: 24 B, Time ms: 0.02
    ScoreFlash.OnGUI(): GC Alloc: 40 B, Time ms: 1.17


    Unity 4.1.2: ScoreFlash 3.1

    cpu-player> min: 18.6 max: 276.5 avg: 54.1

    frametime> min: 22.4 max: 292.7 avg: 65.3
    mono-scripts> update: 11.6 fixedUpdate: 1.5 coroutines: 33.7
    mono-memory> used heap: 454656 allocated heap: 786432
    max number of collections: 2
    collection total duration: 7.1


    Editor Profiler (running in the editor):
    ScoreFlash.Update(): GC Alloc: 1.1 KB, Time ms: 1.86
    ScoreFlash.FixedUpdate(): GC Alloc: 1.6 KB, Time ms: 0.13
    ScoreFlash.OnGUI(): GC Alloc: 1.1 KB, Time ms: 5.09


    Unity 4.1.2: ScoreFlash 3.2

    cpu-player> min: 8.5 max: 20.8 avg: 11.4

    frametime> min: 20.5 max: 46.5 avg: 33.3
    mono-scripts> update: 3.3 fixedUpdate: 0.2 coroutines: 2.0
    mono-memory> used heap: 507904 allocated heap: 524288
    max number of collections: 0
    collection total duration: 0.0


    Editor Profiler (running in the editor):
    ScoreFlash.Update(): GC Alloc: 64 B, Time ms: 0.29
    ScoreFlash.FixedUpdate(): GC Alloc: 24 B, Time ms: 0.05
    ScoreFlash.OnGUI(): GC Alloc: 40 B, Time ms: 1.20


    As you can see, UT also did quite some performance improvements (but keep in mind - this test scene only uses my own C# code and UnityGUI, so many of the improvements that UT did don't have an effect in this comparison because they are related to features I simply didn't use).

    I'll definitely publish 3.2 also for Unity 3.5.7, and maybe the next version as well. But then I'll probably end Unity 3.5.7 support. I've already announced that I will also drop Flash support (now that UT is also dropping Flash support, it's definitely a dead platform).

    If you absolutely need Unity 3.5.7 support and/or Flash support, please let me know soon so we can find a solution!
     
  41. crafTDev

    crafTDev

    Joined:
    Nov 5, 2008
    Posts:
    1,820
    Hey jashan, nice updates coming. And I guess you squashed a problem I had with ScoreFlash creating instances when not in play mode. Nice!
     
  42. LightSky

    LightSky

    Joined:
    Aug 12, 2012
    Posts:
    45
    Is there any chance you are planning on implementing the ability to use ScoreFlash with NGUI's (UI Root) "Fixed Size/ Fixed on Mobile" Scalings? All of my mobile applications use this and it sucks that ScoreFlash doesn't support it.
     
  43. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    Hi LightSky, yes - that's one of the things I'm currently working on for the next version. It's a little tricky because ScoreFlash was designed from the ground up to be "pixel-perfect" but I can totally see that this is needed, so the next version will have it.
     
  44. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    ScoreFlash 3.1 is generating garbage collection, this is profiler on mobile device.

    $scoreflash.jpg

    $scoreflash2.jpg
     
  45. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    Thank you for reporting this. It should be fixed with ScoreFlash 3.2 which is about to be released.
     
  46. metaphysician

    metaphysician

    Joined:
    May 29, 2012
    Posts:
    190
    hi Jashan - first, thanks for the great tool you've created here! just purchased it recently.

    second i have some very specific and different uses i'm thinking of with this tool, relating to an app i'm building with demonstrations. primarily i would like the text to statically display. that is, to come in and stay on the screen until a user presses a button, rather than to scroll up or rotate away. is there a way to disable or suspend the reading and fadeout phase when sending for example, a Push message?

    the same thing goes with the follow mode. i would like a value to display for a a parameter. let's say an Audio Reverb zone object is in the world. i'd like the user/player to be able to adjust the size of a parameter and have Score Flash display/update its settings, again statically. this means i guess i'm looking for a somewhat more boring usage of your useful colorful tool.

    next - i'm a little confused on the NGUI example you included. nothing seems to work for me. i have a pretty new version (2.6.2 i think) of NGUI. i unpacked the demo package and imported it, but the examples do not display anything. based on your video, it looks like i have everything needed to make it work - it's been set to Custom Renderer. And it seems to be using the ScoreFlashRendererNGUI with the transform of the Panel object as the custom parent. is there something else to check regarding this? not sure where i should add your atlas you created, so that might be the situation.

    one last thing - i am using dynamic fonts (TTFs) in NGUI which now supports them. can Score Flash support these through NGUI's rendering or is this not possible?

    any answers or guides very much appreciated.

    thanks in advance,

    scott
     
  47. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    Hi Scott,

    Thank you for the kind words and the purchase ;-)

    Yes, I have introduced a way to do this in ScoreFlash 3.1. There's an example in the scene Xamples-ScoreFlash/Xample_TestLayout. What you need for this is using the class ScoreFlashLayout, in particular it's property freezeOnRead.

    When you check this, and use ScoreFlashLayout.Push(...) instead of going via ScoreFlash, the message fades in, then stays where it is, and fades out as soon as you push the next message. It's usually a good idea - even if not totally necessary - to assign defaultScoreFlash for this purpose (if you don't assign it, it falls back to ScoreFlash.Instance which is fine if you only have one single instance in your scene).

    Well, it's a very valid use case even though I didn't plan for it in the original version. But the current version can do it. In two ways:

    • ScoreFlashFollow3D also has freezeOnRead - so if you do it that way, it's similar to using ScoreFlashLayout. This is what you want to do, if the value only changes every once in a while and you want it fancy. You should not do it this way if you have a slider and change the value continuously (well, you *could* do it - but you might get way too many messages way too quickly; ScoreFlash has means to handle such a situation but it might look funny ;-) ).
    • Keep the ScoreMessage that is returned by any of the Push-methods. This has a property Text which you are free to modify. Of course, you'll still need to have freezeOnRead checked - but instead of pushing each change, you only change the Text property, so this should work well for continuous changes.

    That's very weird ... let me try with the most recent version of NGUI ... so, I've just deleted NGUI from my NGUI-test project, imported the current version of NGUI (2.6.3). I open the first example (NGUI-ScoreFlash/Example1_ScoreFlashNGUI). Hit Play ... and everything works. Maybe I just misunderstood: Do the examples not work for you, or are you having trouble following the example to create your own scene?

    I'm assuming the later is the case ... sometimes setting up NGUI is a little tricky. One thing that a lot of people run into is that up until 3.1, I don't support Scaling Style "FixedSize". This is coming with 3.2 (if that's your issue, I can send you a preview version - the release should be very soon now but with all the possibilities I've built into ScoreFlash I've created a bit of a QA nightmare for myself ;-) ).

    There's quite a few other issues that may cause trouble. Did you find the PDF explaining how to use ScoreFlash with NGUI? It's in NGUI-ScoreFlash / ScoreFlashBasicsNGUI.

    Ah, if you don't see anything, it might be an issue with the Layers (that's step 9 in that document):

    9. Make sure that ScoreFlashRenderer has the layer correctly set (needs to be the same layer as UIRoot and in particular the camera / Culling Mask under that UIRoot), of course, assign that layer to all children of ScoreFlashRenderer as well

    Feel free to contact me via Skype (jashanchittesh) or Jitsi (jashan@jit.si or jashanchittesh@jabber.org) if this doesn't solve it for you.

    I haven't tried using dynamic fonts with NGUI, yet, so I can't say for sure. But I don't see why it shouldn't work and it's something I'll probably need myself very soon ... so in case it doesn't work, yet (which would surprise me), it will work soon.

    Give it a try and let me know how it goes!
     
  48. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    I've just submitted ScoreFlash V3.2 for review to be released on the Asset Store ... I guess it will become available early next week. If you want to buy it - buy it now, because I'm increasing the price to $50; that will go online with V3.2, so there's only a few days left to buy ScoreFlash at $30!

    Here's the release notes:

    3.2.0 is primarily a performance improvement release but also adds (experimental) SpriteManager 2 and Text Box support

    • Text Box: Added experimental support for Catlike Coding’s TextBox
    • ScoreFlashFollow3D: When no reference camera is assigned, Camera.main is used as fallback - but when no camera with tag MainCamera is available in the scene that fallback also fails; added a more informative warning and another fallback (just grabbing any camera that’s available in the scene), so it might work even in that case but you’ll be getting warnings
    • ScoreFlashFollow3D: Instead of testing renderer.IsVisible - which will return true if the renderer is visible in any camera (scene view, minimap cameras, whatever), I’m now doing a test specific to the reference camera; this makes the mechanism to hide messages coming from objects behind the camera much more robust
    • Performance: When ScoreFlash is not enabled, messages are no longer registered
    • Performance: Fixed several places that caused GC-spikes (those were especially related to ScoreFlashFollow3D)
    • Performance: Custom renderers are now handled with an object pool to prevent allocation / instantiation
    • Performance: Added a GUIStyle pool to prevent allocation / GC spikes
    • Performance / NGUI: Custom renderer for NGUI has an option to switch off updating color as this is pretty expensive regarding allocations (resulting in potential GC spikes when running on mobile)
    • SpriteManager 2: Added an example using Sprite Manager 2 (the companion of EZ GUI) to animate a sprite using ScoreFlash; see ScoreFlashRendererSpriteManager2-Package (under Plugins/NarayanaGames/ScoreFlash/CustomRendering
    • NGUI-Integration: Added support for FixedSize and FixedSizeOnMobile
    • NGUI-Integration: Fixed an issue with local pivots which created all kinds of weird behaviors due to a change in NGUI 2.5.0 (FIX: Changing the pivot no longer moves the widget visually, see also: http://www.tasharen.com/forum/index.php?topic=11.25)
    • Added menu “GameObject / Create Other / Score Flash Layout” - in addition to the already existing entries Score Flash and Score Flash Manager
     
  49. dkozar

    dkozar

    Joined:
    Nov 30, 2009
    Posts:
    1,410
    Great to see you are continuously adding features! :)

    Although I've never used it (I'm not building games), this is for sure one of the most interesting and inspiring assets on the store in my opinion.

    Yeah, that's the way to go! Object pooling fits perfectly with Unity.

    The rule of thumb is you should go lazy with everything, and when you create something, you should cache it and reuse it.

    (also, you have to cache not only the styles, but Rects (used for rendering) - creating Rects using the new operator in runtime (except during the initialization and position/size changes) is the indication of not-so-optimized code)
     
  50. jashan

    jashan

    Joined:
    Mar 9, 2007
    Posts:
    3,307
    Thank you! :) I haven't forgotten about the eDriven.GUI integration, btw ... maybe I'll finally get to do this for the next release.

    Actually, you can also keep the same rect for position / size changes. That's the way I'm doing it in ScoreFlash: ScoreMessage has its position in a Rect, and while I'm animating the messages, the x and y are being constantly updated - but no new Rect created ... well ... except for some code where I felt it didn't matter (like, stuff that only runs in the editor) ... and ... ooops ;-) ... also in the code that's generating the outlines. That's usually not running on mobile devices, so it shouldn't be such a big deal - but I'll fix that for the next version ... even though fortunately, Rects are implemented as structs and as such shouldn't create trouble with GC, so while this will give a little bit of extra performance, I don't expect it to make a big difference. But it's cleaner anyways ... so ...

    Thank you for the heads up ;-)