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
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/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.