Hey here’s my script for multi-color scrolling Who Killed Who messages.
Download the package and import it. You are going to want to modify this file though, it contains examples.
Note the whole thing is driven off statics so you don’t need references you can just access the features through Messages.Message from your script.
- Configure the screen location you want by changing Messages.Message.messageStartPosition either in the code or at runtime. Note: start positions will be rounded to a multiple of verticalSpacing on start up. If you move it, perhaps to account for screen resolution, make sure that it is a multiple of verticalSpacing or the results will not be pretty.
- Set the Y coordinate where fades will start irrespective of time. It’s Messages.Message.fadeY
- Set the spacing of messages. Messages.Message.verticalSpacing
- Choose your GUI skin/style for Label in the OnGUI call.
Displaying a Message
To display a message:
- Call Messages.Message.QueueMessage(“Your message”); from any script
- Messages support multiple color strings by using some custom formatting in the string:
- Either a plain string or red,green,blue:My string|red,green,blue:Another string
You can have any number of those combinations: an example is “1,0.4,0.5:Hello |1,1,1:World”
- You can also display a multi colour string from any OnGUI by using
Where position is a Vector2
I’ve included some examples to see it working…