Hello, I’ve been following the unity ‘Text Based Adventure Game’ tutorial, but have run into a problem.
/n does not create a new line. it simply shows up in my text, like so, “lorem ipsum /n”
I am pasting the entire script because I am not sure where this problem originates from. Any help is greatly appreciated
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class gameController : MonoBehaviour
{
[HideInInspector] public roomNav roomNavigation;
List<string> actionLog = new List<string>();
public Text displayText;
void Awake()
{
roomNavigation = GetComponent<roomNav>();
}
void Start()
{
DisplayRoomText();
DisplayLoggedText();
}
public void DisplayLoggedText()
{
string logAsText = string.Join("/n", actionLog.ToArray());
displayText.text = logAsText;
}
public void DisplayRoomText()
{
string combinedText = roomNavigation.currentRoom.description + "/n";
LogStringWithReturn(combinedText);
}
public void LogStringWithReturn(string stringToAdd)
{
actionLog.Add(stringToAdd + "/n");
}
}