In-Game Wiki in Unity in 15 min

This solution is ideal if you need a simple way to create a wiki in your game.

Solution is based on TextMesh Pro component.

The game itself is in active development, you can subscribe for updates about what does it mean to be manager

public class …


This content originally appeared on DEV Community and was authored by Mike Krop

This solution is ideal if you need a simple way to create a wiki in your game.

Solution is based on TextMesh Pro component.

The game itself is in active development, you can subscribe for updates about what does it mean to be manager

public class WikiUI : MonoBehaviour, IPointerClickHandler
{
    public TextMeshProUGUI text;

    public void OnenWikiAbout(string page)
    {
        text.text = "<line-height=125%>";

        if (page == "negotiations")
        {
            text.text += "Negotiations<br>Negotiations start when there are several opinions on the next steps. During negotiations, you and your colleagues communicate about which course to take.";
        }
        else if (page == "homepage")
        {
            text.text += "Wiki Index:<br><link=negotiations><u>Read about negotiations</u></link>";
        }
        else
        {
            text.text = "404<br>";
        }

        text.text += "<br><link=homepage><u>Go Home</u></link>";
    }

    public void OnPointerClick(PointerEventData eventData)
    {
        // camera is null only if you use Screen Space Overlay, otherwise add camera reference
        int linkIndex = TMP_TextUtilities.FindIntersectingLink(text, eventData.position, null);

        if (linkIndex != -1)
        {
            TMP_LinkInfo linkInfo = text.textInfo.linkInfo[linkIndex];
            OnenWikiAbout(linkInfo.GetLinkID());
        }
    }
}


This content originally appeared on DEV Community and was authored by Mike Krop


Print Share Comment Cite Upload Translate Updates
APA

Mike Krop | Sciencx (2023-05-07T15:47:10+00:00) In-Game Wiki in Unity in 15 min. Retrieved from https://www.scien.cx/2023/05/07/in-game-wiki-in-unity-in-15-min/

MLA
" » In-Game Wiki in Unity in 15 min." Mike Krop | Sciencx - Sunday May 7, 2023, https://www.scien.cx/2023/05/07/in-game-wiki-in-unity-in-15-min/
HARVARD
Mike Krop | Sciencx Sunday May 7, 2023 » In-Game Wiki in Unity in 15 min., viewed ,<https://www.scien.cx/2023/05/07/in-game-wiki-in-unity-in-15-min/>
VANCOUVER
Mike Krop | Sciencx - » In-Game Wiki in Unity in 15 min. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2023/05/07/in-game-wiki-in-unity-in-15-min/
CHICAGO
" » In-Game Wiki in Unity in 15 min." Mike Krop | Sciencx - Accessed . https://www.scien.cx/2023/05/07/in-game-wiki-in-unity-in-15-min/
IEEE
" » In-Game Wiki in Unity in 15 min." Mike Krop | Sciencx [Online]. Available: https://www.scien.cx/2023/05/07/in-game-wiki-in-unity-in-15-min/. [Accessed: ]
rf:citation
» In-Game Wiki in Unity in 15 min | Mike Krop | Sciencx | https://www.scien.cx/2023/05/07/in-game-wiki-in-unity-in-15-min/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.