I have a long piece of text, in which I’d like to bind a scene change event when a certain word inside the text is clicked, is this possible?
For example:
I love Apple
I’d like to make it such that when the user clicks on the word Apple
, the scene changes to another scene (similar to how <a href="">
works in HTML.
GUIText doesn’t provide any feedback where which character has been placed on the screen. The best way to do something like that would be to use the “new” hui system of Unity. In other words OnGUI callback and Labels together with Buttons.
If you use GUILayout with a Horizontal group it will look like one text. Use a GUYLayout.Button for the clickable part. Make sure you use the same GUIStyle as the label:
GUILayout.BeginHorizontal();
GUILayout.Label("I love ");
if (GUILayout.Button("Apple", "label"))
{
// Do something
}
GUILayout.EndHorizontal();