You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The text generator currently moves an alpha tag to change what characters are visible, which is not optimal for garbage collection. A solution to this is to use the following code in place of the function that changes the location of the alpha tag, but some changes would likely need to be made since this is mostly unmodified from the system that I use. // textField is the text object that the player sees, and is also where the unformatted text starts // I don't remember what tempString does, I just know that you need it // I also don't remember what start or end index do , but again, they are very important public void InitializeText() { textField.color = Color.clear; textField.text = text; Canvas.ForceUpdateCanvases(); for (int i = 0; i < textField.cachedTextGenerator.lines.Count; i++) { int startIndex = textField.cachedTextGenerator.lines[i].startCharIdx; int endIndex = (i == textField.cachedTextGenerator.lines.Count - 1) ? textField.text.Length : textField.cachedTextGenerator.lines[i + 1].startCharIdx; int length = endIndex - startIndex; tempString += textField.text.Substring(startIndex, length) + "\n"; } textField.text = string.Empty; textField.color = Color.white; // Replace with whatever color you need text = tempString; }
I'm sorry I don't know as much as I should about a script that I wrote, but I wrote this a very long time ago, and I never used to put comments in my code (I have since learned my lesson), so I hope you can make at least some sense of this. Despite all of these problems with it, I hope you get at least some use out of this script even though it was very poorly done, and i will probably need to redo it at some point
The text was updated successfully, but these errors were encountered:
The text generator currently moves an alpha tag to change what characters are visible, which is not optimal for garbage collection. A solution to this is to use the following code in place of the function that changes the location of the alpha tag, but some changes would likely need to be made since this is mostly unmodified from the system that I use.
// textField is the text object that the player sees, and is also where the unformatted text starts // I don't remember what tempString does, I just know that you need it // I also don't remember what start or end index do , but again, they are very important public void InitializeText() { textField.color = Color.clear; textField.text = text; Canvas.ForceUpdateCanvases(); for (int i = 0; i < textField.cachedTextGenerator.lines.Count; i++) { int startIndex = textField.cachedTextGenerator.lines[i].startCharIdx; int endIndex = (i == textField.cachedTextGenerator.lines.Count - 1) ? textField.text.Length : textField.cachedTextGenerator.lines[i + 1].startCharIdx; int length = endIndex - startIndex; tempString += textField.text.Substring(startIndex, length) + "\n"; } textField.text = string.Empty; textField.color = Color.white; // Replace with whatever color you need text = tempString; }
I'm sorry I don't know as much as I should about a script that I wrote, but I wrote this a very long time ago, and I never used to put comments in my code (I have since learned my lesson), so I hope you can make at least some sense of this. Despite all of these problems with it, I hope you get at least some use out of this script even though it was very poorly done, and i will probably need to redo it at some point
The text was updated successfully, but these errors were encountered: