Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

MessageManager for EZGui

Discussion in 'Assets and Asset Store' started by Adam-Buckner, Mar 14, 2011.

  1. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    MessageManager 1.1 is now available on the asset store for the introductory price of $10.00.



    MessageManager is a full color, low draw call, batchable, fading, clippable, scrollable, drop shadowed messaging system for EZGui.

    Messages can be sent to any number of fully formatted displays with only one line of code from anywhere within your game's systems!

    For more information, go to the MessageManager page on The Ant Ranch site.

    MessageManager REQUIRES a licensed installation of EZGui from Above Beyond Software. More info on EZGui can be found at http://anbsoft.com/middleware/ezgui.

    MessageManager can also be purchased from The Ant Ranch's eStore for the introductory price of $9.99.


     
    Last edited: Mar 14, 2011
  2. DisTrash

    DisTrash

    Joined:
    Feb 2, 2009
    Posts:
    166
    Hi,

    It seems really cool, and for RPG and more it will be a must.

    I don't know how to code, and i have GUIX extended.

    Can i use it instead of EZGui ?

    If not , GUIX Extended will be compatible with your asset in the future ?


    Thanks a lot !!

    Best Regards.
    ;) ;) ;)
     
  3. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    Unfortunately, this system is requires the SpriteText components from EZGui for the low draw calls and sprite management.

    This is a sprite based messaging system which routes messages generated by your code to formatted message displays within your HUD or within the game world.

    I do have a UnityGUI version in the works, but it's in the queue behind an Inventory Manager for UnityGUI (in C# and JS), and an Inventory Manager for EZGui.

    That being said, if there is interest in MessageManager for UnityGUI, I can bump it up a notch in the queue.
     
  4. DisTrash

    DisTrash

    Joined:
    Feb 2, 2009
    Posts:
    166
  5. DisTrash

    DisTrash

    Joined:
    Feb 2, 2009
    Posts:
    166
    I found this :

    http://www.cwsof.com/purchase.html

    It said that EzGUI is not for Unity3D use, it is the wrong site or software or is there any special license for unity3D.

    Hope don't be out of topic ;)

    Thanks a lot !! ;)
     
  6. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    Yes - you should follow the links on the page to the EZGui site (http://anbsoft.com/middleware/ezgui/) as it turns out there is also an "EZGui" front-end for PowerBasic! Don't want to get them confused...

    -

    You can also find EZGui from within Unity's Asset Store (Window/Asset Store from the menu in Unity3D), but to be honest, you can wait for upgrades to be processed thru the Asset Store, and if you buy it directly from A&BSoft, you will have no delays in obtaining your upgrade.
     
    Last edited: Mar 14, 2011
  7. DisTrash

    DisTrash

    Joined:
    Feb 2, 2009
    Posts:
    166
    Is EZGui free lifetime upgrades ? Any discount offers in the year ?

    Hope don't disturb you.

    Thanks again.

    ;) ;) ;)
     
  8. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    These would be best addressed to Brady, who is the author of EZGui. The thread for EZGui can be found here:
    http://forum.unity3d.com/threads/50607

    So far, EZGui is still in 1.0x, so it's been one single purchase and free regular upgrades. It's a great bit of kit, and for mobile GUI's is very very useful.

    I just hope I've added a little interest to the pot with MessageManager.
     
  9. mindlube

    mindlube

    Joined:
    Oct 3, 2008
    Posts:
    993
    I bought it MessageManager! The video tutorials are nicely done as well.
     
  10. DisTrash

    DisTrash

    Joined:
    Feb 2, 2009
    Posts:
    166
    Hi,

    Message manager seems so good, i think buy EZGui especially for but i have GUIX and not the money for.

    Do your asset will be in sell for long time ?

    No chance to contruct the same message system but on a GUIX Base ? If Guix implant sprite system in the future will i be able to use your asset.

    In the worst situation i will wait to have money for licenses, EZGui and your asset.

    I will put more questions on the EzGui topic.

    Thanks a lot !!

    Best Regards.
    ;) ;) ;)
     
  11. nikko

    nikko

    Joined:
    Mar 20, 2009
    Posts:
    436
    EZGUI is TOO expensive. If you add up all the things you need to buy to make a game, you are better off working with Unreal Engine. This is insane: $200, plus $200 for Sprite manager, plus whatever.
    Make your message or anything you do independent from any other things. In the next release if Unity makes a better management for the GUI and Sprites (which I think would be a GREAT idea) everyone who purchased these will be screwed. It happened already, it will happen in the future, nothing should cost more than $100 in the Asset store.
     
  12. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    I have MessageManager for UnityGUI on my todo list, but currently I'm primarily targeting mobile devices and an actively involved in the EZGui community, so I produced MessageManager for EZGui first.

    Unfortunately, EZGui and UnityGUI are far too different and deal with text in such fundamentally different ways that one cannot develop an independent message manager that would work with both systems. (Or if one did, it would merely be both systems wrapped up in an envelop with some sort of system detection... which amounts to the same thing... one needs two different systems.)

    Unity in no way requires EZGui or SpriteManager. Or GUIManager, or SpriteUI or an of the many additional extensions available to Unity to make a game. What I think these addons do is take much of the burden off of a serious games developer for a paltry price. If a developer were to look closely at EZGui or SpriteManager2 (and don't forget some of the solutions like the original SpriteManager and SpriteUI are free), the developer will quickly realize that EZGui is worth the price compared to cold coding a similar solution from scratch. For the independent, who could be using the free version, these prices could seem steep, but then again, there are some free alternatives.

    I find UnityGUI to be a very powerful and versatile system. It's just not adequately optimized for mobile devices. If Unity does start to support a better sprite solution, it won't include all of the animation controls and other benefits available from EZGui. EZGui is an incredible powerful package, which just recently added drag-n-drop to its list of features. This still needs to be hard coded in UnityGUI even with AngryAnt's help.

    All this being said, this is probably a better to have this discussion here: http://forum.unity3d.com/threads/50607-EZ-GUI-Powerful-Low-draw-call-GUI-solution, rather than in this thread. If on the other hand, you are interested in MessageManager for UnityGUI, please let me know, and I'll push it up the priority list.
     
  13. mindlube

    mindlube

    Joined:
    Oct 3, 2008
    Posts:
    993
    Wow- that's a strong opinion. I'm sure EZGUI would be less expensive, if the market didn't support it. The fact is that currently UnityGUI is not optimal on mobile devices, especially with layout-ing enabled. EZGUI is optimal for mobile devices, and I am sure that EZGUI author Brady is cashing in on this niche market currently, because it is no secret Unity is developing new GUI features for the future.
     
  14. nikko

    nikko

    Joined:
    Mar 20, 2009
    Posts:
    436
    How many people will buy a $200 expansion? How many will buy a $50 expansion? If you get 10x time sales because you are less expensive, you make more money.
    I don't think doing Unity add-on is a full time job but I think it is a good thing to have a market place at Unity. Bottom line, I have purchased GUI for Blitz Basic, for Gamemaker, etc... they never cost +$100.

    Your message system is great and I am waiting your inventory system impatiently. Just make your expansion <$50 and you will sell a lot (I would buy it)
     
  15. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    Mmm...

    Don't forget the EZGui is from Brady at Above Beyond Software (http://www.anbsoft.com/middleware/ezgui/). MessageManager is an addon for EZGui. I'm a healthy user of EZGui, but I'm not involved in its development. There are some discussions about EZGui and its price. You should check out either the Unity Forum thread: http://forum.unity3d.com/threads/506...l-GUI-solution or the EZGui forum: http://forum.anbsoft.com/ Both sites have a lot to read, so you may need to do a search to find the pricing discussions.

    Thanks! I'm going to give up on the Asset Store for now, and try to get it up on my own eStore next week. Just a lot goin' on and I'd like to get as much done to it as possible.

    In reverse order to MessageManager, I'll be offering InventoryManager for EZGui, but that will have to wait for some other projects to get finished.
     
  16. dabrow

    dabrow

    Joined:
    Nov 15, 2010
    Posts:
    22
    Hi waiting for Inventory manager too.
    I have bought Message Manager for EZ GUI and it rocks !

    Peter
     
  17. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    Don't forget that there are at least two different UNRELATED software packages called EZGui. Make sure you are watching videos related to A&BSoft's add-on for Unit3D!
     
  18. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
  19. Enzign

    Enzign

    Joined:
    Aug 20, 2010
    Posts:
    169
    I'm really waiting for the 1.1.1 update. Is there any timeframe that people can look forward too? The message on point is really needed in my project. Thanks for a good product.
     
  20. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    D'oh!

    I've been snowed under with a contract job. Alas, if my sub-systems could pay my mortgage.

    Thanks for the nudge. I'll see what I can get done this week. I expect to ship a version today/tomorrow, which will leave me tomorrow/Friday to look at MessageManager. I have a rough beta, but it needs polish.

    If I have not released anything by the weekend, please feel free to bump me again for a better estimate.
     
  21. Enzign

    Enzign

    Joined:
    Aug 20, 2010
    Posts:
    169
    Wow, awsome. That's very good news. And good luck with your contract job, mortgage is always hanging over us like a black stormcloud!
     
  22. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    Joakim: Thanks for nudging me. I do have just enough going on that I do drop the ball sometime and need a gentle reminder.
     
  23. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    Update History:
    1.1.1 Messages at a Point and Pooling
    Added two new Message() overloads.
    - Message (string thisDisplayID, string message, Vector3 thisDisplayPosition)
    - Message (string thisDisplayID, string message, Vector3 thisDisplayPosition, Color color)

    Added "Pooling", where the system, on start, creates a pool of SpriteText objects.

    These two overloads display a message at a point in space set by a Vector3 passed to the overload along with an optional color.

    These two overloads *REQUIRE* "Pooling".

    To use pooling, "Pool" needs to be selected for that particular Message Display, and "Pool Size" to be set to a number larger than 0. "PoolSize" should preferably be large enough to accommodate all the displays you will need while the game is running. Messages with out an available Message Display in the pool will be skipped. When setting up the Message Display in the Message Displays List in MessageManager, I would suggest that you use a prefab containing a SpriteText Label, set up with the appropriate SpriteFont definition and material. "Pooling" currently does not work with clipping, drop shadows or scroll lists.

    You can see an example of Messages at a point and Pooling on the webplayer here on the MessageManager page:
    http://theantranch.com/MessageManager.html

    This update is being submitted to the AssetStore and eSellerate today.
     
  24. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    This update has been submitted for approval to the Asset Store. It is pending review.

    Currently MM-1.1.1 is available on our eStore.

    For all eStore (eSellerate) customers - downloading code updates should be possible by following these instructions:

    "If you have previously purchased a license, you can download the very latest version via After-Purchase Services, at http://store.esellerate.net/support. Please log on using your e-mail address and your original order ID (found in your receipt and in your Order Confirmation e-mail message), and then click there here link in the Re-download section after logging on. This will display your original receipt, complete with a DOWNLOAD NOW button you can use to download the latest version of the product."

    Please follow this topic on The Ant Ranch forums for more information:
    http://theantranch.com/forum/viewtopic.php?f=25&t=1181
     
  25. Enzign

    Enzign

    Joined:
    Aug 20, 2010
    Posts:
    169
    Thanks! Will install and try the new point functionality. Will be the perfect fix for our upcoming game. :)
     
  26. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    Let me know how it works for you, and if there are any problems or deficiencies.
     
  27. sonicviz

    sonicviz

    Joined:
    May 19, 2009
    Posts:
    1,051
    Hi,
    I Installed it and got two errors on SpriteText.Color which I had to change to SpriteText.color.
    I have the latest ezgui (non beta) installed, pretty sure.
    Would be great if you could make the videos a seperate download from website, to cut the size down, and also a complete demo rather than have to build it from scratch (which is what it is if I am not mistaken?).

    Great addon btw!
     
  28. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    SonicViz: Let me check that out. It worked fine for me in my clean test instance. I'll see if there's an issue.
     
  29. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    SonicViz: Sorry, I realized I hadn't answered all of your questions.

    - I should split out the videos, yes. As I *hadn't* cut down the big one (which I need to do) into the 10 minute chunks needed for youTube, I left the full ones in. I have it on my list to cut them down and host them separately.

    - I can't supply a fully working demo, as that would require redistribution of the EZGui code. I always have to release at least a partially crippled version of any demo as the client will have to add the EZGui scripts. I could experiment with distributing a version of the demo with EZGui stripped and see how well it performs when the client tries to resuscitate it with their copy of EZGui. I've had surprisingly good success with Unity remembering what scripts I have removed and replaced in my own projects - the "missing monobehaviour"s seem to fix themselves most of the time without help, but I'm unclear how Unity and it's GUID's work when passing a partial project between developers.
     
  30. sonicviz

    sonicviz

    Joined:
    May 19, 2009
    Posts:
    1,051
    ah, yes, ye olde missing script! I know it well! ;-)
     
  31. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    I've updated the forum on my site, including upgrading the bot filter as I overlooked a few posts from legitimate users in the sea of spam. Sorry!

    If you have not heard back from me, please send me a PM here, email to info at theantranch dot com, or post in the appropriate forum thread.
     
  32. runonthespot

    runonthespot

    Joined:
    Sep 29, 2010
    Posts:
    305
    Bought this and it works quite nicely. Quick questions

    1) How do I create and assign a messagedisplay to the messagemanager during runtime? Is this possible? When I tried it in the editor it seemed to break fading and shadows

    2) Do you have a suggestion for attaching a display to a moving character? Dreading slightly having to make a message window follow something around screen without allowing the clip bounds to be out of view.

    Very neat little script- nice job.
     
  33. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    Currently creating the message display at runtime isn't supported. The script sets up drop shadows and references at start. What I should look into doing is an "AddDisplay()" method for this.

    To attach a display to a moving character... attach it to a moving character! (^_^) That was a bit cheeky. As the displays reference a sprite text object and you these reside in the game world, you can assign it to your character transform as a child and then make sure that this is set to a layer visible to the main game camera.

    Look at how the two chests are set up in the videos. They are in-game-world displays. If one were to move the chest, the displays would follow as attached children.

    Does this help?
     
  34. runonthespot

    runonthespot

    Joined:
    Sep 29, 2010
    Posts:
    305
    Unfortunately my game is a 2d space sim, and the characters rotate, so attaching the script as a child doesn't work for me. I realise this is more likely my own problem to deal with- as the camera that views the on screen objects zooms in and out too- I want my game characters to get larger and smaller on screen, but UI to remain the same size- obviously this means two cameras and some translation. I digress.

    Regarding runtime/design time, I noticed the "pool" setup, and wondered if that isn't the answer? I know more or less how many displays I need (probably two would work for a start), so can I instantiate them at the start in some sort of off-screen pool, and then attach them (or at least have their transforms move appropriately) at runtime?
     
  35. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    Yes, you can "add" messages to the Pool at runtime, but, in their current implementation, they will stay at that location and not move around. They are really meant for transient messages. They get instantiated at a point, if a fire and forget way, and they don't follow objects.

    Let me check out what it is that you ultimately want...

    Do you need these labels to change during the course of the game? Or are these literally character labels? Like me having "Little Angel" floating over my head, or "Earth 2" attached to a planet?

    If you just need a label, and the label needs to be sized for the UI, not proportional to the character, I'd do this with two layers. I'd have a transform attached to my in-game object called something like "TitleTarget" or "TitleSpawn". Then I'd have a SpriteText object in my UILayer being rendered only by my UICamera, and then I'd use code in a co-routine or update that is something like this:

    Code (csharp):
    1. Vector3 screenPos = subject.camera.WorldToScreenPoint(target.hitCounterTarget.position);
    2. Vector2 newScreenPos = Vector2.zero;
    3.            
    4. newScreenPos.x = Mathf.Round(((screenPos.x/Screen.width) * 960) - 480);
    5. newScreenPos.y = Mathf.Round(((screenPos.y/Screen.height) * 640) - 320);
    6.            
    7. uIElements.hitCounterOther.transform.localPosition = newScreenPos;
    This is code from one of my games where I'm repositioning a hit counter for the opponent on the player's screen. It will always be the same size regardless of the range of the opponent.

    I feel that code needs tweaking. In my case it needs a calculation on the y-axis that takes into consideration the opponent's range from the player, as the distance between the transform and the spawn/target point will change in the player's UI - shrinking as the opponent's range increases. This could lead to a cramped feeling as the label apparently moves towards the opponents unit at a greater range, and/or floats too far away when the opponent is close.

    Don't forget that MessageManager is really designed for sending changing and usually temporary messages to either a location on screen or a point in game space. For simple, permanent, persisting, unchanging labels, a SpriteText label component would be fine by itself.

    Let me know if I missed something, and I'll try another suggestion.
     
    Last edited: Jul 18, 2011
  36. runonthespot

    runonthespot

    Joined:
    Sep 29, 2010
    Posts:
    305
    That's quite helpful, and I'll try it out. Actually, the best analogy for what I'm trying to do is modelled on dialog text like in a monkey island 2 like game. Something like this

    My ships will be "speaking" and having conversations. I'm trying to position the text just above or beneath the moving character, and like the simple messaging methods to enable me to pipe messages to the ship from different components (e.g. to handle messages that are equivalent to "Low health" but also, when getting in close proximity to a sun "Sir, it's getting rather hot in here!" or when approaching some new alien "By the Spathi! What is that?!". Your setup will make this exceptionally easy.

    I think I'll be able to do this by just having a number of displays off-screen, which I can setup at design time, and then managing them and assigning the "follow this prefab" behaviour at runtime as required. I was planning to do it in separate layers as you suggested.
     
  37. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    Sounds like you are on the case!

    You may not have to worry about keeping them "off screen" as the SpriteText objects are empty/blank if they have no messages displaying. Is the concern that there will be too many objects? Is this the case that there could be, say, 100, 1000, howevermany, units and they all need registered displays?

    I'm unclear why it would be trouble just giving each unit a display of their own.

    I can imagine a number of situations where this could be a problem... too many displays to manage is one of them.

    It makes me ponder on the necessity of a registration method... give each unit a sprite text object and have them register with MessageManager rather than have to pre-assign them all manually.

    The other ponder is using an unassigned pool, but the routing could be a problem. How would one address a message?

    May I ask where the messages come from? Do all of the messages come from controllers on the units? Are there many messages coming from a global "GameController/GameManager"?

    I'm also wondering if there is a more direct solution where each unit owns their own display, rather than routing thru a central manager.

    I ponder...
     
  38. runonthespot

    runonthespot

    Joined:
    Sep 29, 2010
    Posts:
    305
    Good pondering :) The units are composed at runtime- they can consist of the mesh, various weapon scripts, AI (or a player controller), special effects (e.g. mesh warping in one case). There isn't a prefab for each combination- just a simple game manager that combines the appropriate bits.

    Ideally I'd have liked to have just been able to instantiate the display at that point, and tack on a "follow this transform" script. Depending on the scene, I'd say probably half a dozen displays, tops, and frankly, I figure it's not too hard to track via a manager arraylist referencing the displays- strictly for routing purposes. So for example, the ship, once composed, would register itself with the routing manager, (requesting a text colour, maybe) which would return it an appropriate display handle.

    I reckon it doesn't need to be too complex, but I simply don't have anything to attach the messagedisplay to at design time. I can't really bake it into the prefab of the ship, as I said, the ship can rotate, and the messagedisplay mustn't, so they can't be parent/children of each other.

    The message display could be populated by combination of environmental/event driven actions (health is low, powerup is gained) or prescripted bits (probably managed by a dedicated "storyManager" that will sort of put words into the player's mouth in response to a dialog UI, or story events happening, in a fairly static scripted way.

    I'm still kind of working it out as you can hear!
     
  39. runonthespot

    runonthespot

    Joined:
    Sep 29, 2010
    Posts:
    305
    Right, solved following around the screen, quite easily in the end. I use camera.WorldToScreenCoordinates for the transform I'm following, then clamp the screen coords so the dialog message is always on screen, then guiCamera.ScreenToWorldCoordinates to find the appropriate placement position for the label. This is working very well indeed.

    Incidentally, found Glyph Designer for mac app last night- it's way easier than Hiero for making fonts although $30.
     
  40. aigam

    aigam

    Joined:
    Dec 31, 2005
    Posts:
    170
    I will only say, fantastic product!
     
  41. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    Aigam! Thanks! And if you're talking about Glyph Designer (http://glyphdesigner.71squared.com) it IS a fantastic product. The only feature I would like to see is to be able to create an arbitrary space around the glyphs on the sprite sheet so one could import the sprite sheet into photoshop and add effects while maintaining the accuracy of the definitions file. But this is just me asking for ice cream on my apple pie.

    Say, I just noticed that they also have Particle Designer (http://www.71squared.com/iphone-apps/particle-designer-ad) which I need to check out! Wonder if it could work with Unity and whether or not it will be of any value compared to the built in one.

    runonthespot: So, are you simple creating your own pool of displays and then grabbing them as you need them?
     
    Last edited: Jul 20, 2011
  42. runonthespot

    runonthespot

    Joined:
    Sep 29, 2010
    Posts:
    305
    Haven't quite got to pooling yet, but have marginally extended your class to enable me to set a transform to follow at runtime. It's all working brilliantly.

    Quick question: Is there some way I can limit the display to a single line of text at a time?

    This class is a great base for a dialog system- I might implement some basic queueing of messages + interrupt to handle the nuances of dialog stuff, and so far experimentations with extending it have been very easy.

    Really like this extension, mate- it's opening up a whole new area in my game.
     
  43. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    Yay! I'm glad you like it.

    If you run into trouble, shout, but it seems like you've got it under control.
     
  44. runonthespot

    runonthespot

    Joined:
    Sep 29, 2010
    Posts:
    305
    Sorry, buried a question in my last message- could you explain how I would limit the display to a single line of text, so subsequent messages just replace it?
     
  45. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    Currently, that's one of the uses of ClearMessages (string thisDisplayID). A better explanation is in the docs/tutorials... but... ClearMessages() clears all of the messages in a display. If you were to have a method that was void MyNewMessage () { messageManager.ClearMessages ("myDisplay"); messageManager.Message("myDisplay", myMessage, myColor);} you should never have more than one message in the display at any one time.
     
  46. runonthespot

    runonthespot

    Joined:
    Sep 29, 2010
    Posts:
    305
    Perfect.

    Right, I've implemented the display pool, and it works well.

    To do this, I :
    1) Added a member variable to the MessageDisplay class of type GameObject called Owner
    2) Added these functions:
    Code (csharp):
    1.  
    2.         public string RequestNewDisplay(GameObject caller)
    3.     {
    4.         for (int i = 0; i < messageDisplays.Length; i++) {
    5.             if (messageDisplays[i].Owner != null)
    6.             {
    7.                 if (messageDisplays[i].Owner.name == caller.name)
    8.                 {
    9.                     Debug.Log(caller.name+" Requested a new display, returning "+messageDisplays[i].thisDisplay);
    10.                     return messageDisplays[i].thisDisplay; 
    11.                 }
    12.             }
    13.         }  
    14.        
    15.         for (int i = 0; i < messageDisplays.Length; i++) {
    16.             if (messageDisplays[i].Owner == null) {
    17.                 Debug.Log(caller.name+" Requested a new display, assigning "+messageDisplays[i].thisDisplay);
    18.                 messageDisplays[i].Owner = caller;
    19.                 return messageDisplays[i].thisDisplay;
    20.             }
    21.         }
    22.        
    23.         return null;
    24.     }
    25.  
    26.         public void Message (GameObject caller, string message, Color color)
    27.     {
    28.         string handle = RequestNewDisplay(caller);
    29.         if (handle != null)
    30.         {
    31.             Message(handle,message,color); 
    32.         }
    33.     }
    34.  
    then basically, any gameObject can just call for example:

    Message(gameObject,"My message",Color.red);

    I then just set up a bunch of displays (with any names) and assign them to the MessageManager

    The first time Message is called this way from a gameobject, the gameobject gets permanently assigned the first free display. Any subsequent calls from the same object will be routed to the appropriate display.

    As it's just an overload, anyone could still pipe a message directly to the display by name if they want, and if some other object in the hierarchy wanted to put words in the mouth of that object, I can easily write another method that returns the appropriate display by gameObject's name (for example).

    So that was pretty easy :) Thanks for all your help.
     
    Last edited: Jul 21, 2011
  47. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    NP! Let us know when you've released something so we can swarm down and buy it!
     
  48. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    I have disabled the "newly registered user" requirement on the forums at The Ant Ranch, including MessageManager. The current capcha scheme seems to have stopped the bots cold. If I get a new wave of bots that can defeat this security, it will come back, but currently you can post without admin approval from the first post.

    http://theantranch.com/forum/
     
  49. Adam-Buckner

    Adam-Buckner

    Joined:
    Jun 27, 2007
    Posts:
    5,664
    Is there any interest in adding an "UpdateDisplay()" method to the arsenal?

    Currently this is probably better done directly with a call to the SpriteText.Text property, but will require a new variable set in the controlling script. If developers would like to manage all their displays from one place (MessageManager), I can add this in.

    http://theantranch.com/forum/viewtopic.php?f=23&t=1326
     
  50. runonthespot

    runonthespot

    Joined:
    Sep 29, 2010
    Posts:
    305
    Hey man,

    Another slightly curious one to resolve: I'm currently using a two camera setup, GUICamera = orthogonal and Main. My code uses WorldToScreen to get position of a spaceship, then GuiCamera.ScreenToWorld to get appropriate transform for the MessageDisplay.

    Neatly, in between, I can constrain the screen coordinates to stay within bounds, so that works nicely. The only thing I haven't figured out how to do is keep longer sentences on screen. Currently I can get just one coordinate for the spritetext- but no easy way of getting its dimensions. Is there something simple I could do to expose that? Where exactly would I get that information?

    Regs,
    mike