Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Please look at the stage example scene and find the script named "STMEventInterpreter"! It has a custom event (<e2=myEvent>) that's used to spawn a "link" prefab overtop of letters. I believe this is better than any built-in system because it can be customized with any type of overlap method and do anything when clicked. The default prefab spawned uses OnMouseDown() and prints a debug message, and uses the script "STMSampleLink" to do this.


I keep getting this question, so I'll try to make this its own sample scene with a dedicated custom script for the next update! But for the time being I hope this helps.

Thanks for replying,

The stage scene is not working. The OnMouseDown is not fired. I tried clicking everywhere on the scene, nothing happens.

I believe just one line of dialogue in the stage scene uses the link function (it used to be my demo scene for everything before I split it up)

Either way, taking the STMEventInterpreter script and putting it on another STM object should allow the link function to work on any STM object, as long as the prefab is defined. Hopefully I'll be able to add the standalone module soon, but this functionality does work!


Ok, I think I got a solution working! I'm happy with how this component works, here's how it looks in the inspector:


Basically, this allows you to type <link=on>, and it will create or grow colliders in the right spots. </link> can be used to stop a link. You can even define a string to be inserted before a link, so you can have effects applied automatically to clickable text. (<c=blue> in this example) The defined events are copied to colliders that are placed on clickable text.

This system just uses UnityEvents, but the code can be edited for a more robust system for clicking callbacks if needed. 

There's a few scripts for this (works on both Unity UI and without!) so send me an email with your asset store invoice number if you want to try it out early, otherwise I'll include this in the next STM update, which I should hopefully get out soon!