- Home /
Mysterious crash after updating text of Input Field from script
Good morning!
I have some old code (working last time I used it) from a Unity 2018 project that I copied into a script in a Unity 2019 project. I have an input field in my UI that I update with InputField.text = (string)NEW; inside an update method.
If I call that method from a button press and pass an argument (NEW) through the UI (Inspector-> ON CLICK() -> Update Method -> Argument: NEW), it works. If I call that update method from another method in the script and pass the same value for NEW as an argument, it crashes.
Any thoughts as to why this might be happening? My thoughts so far is that the value for NEW is being updated asynchronously in the first method and is not fully updated when I attempt to write the value to the InputField, causing a crash, but I have not come up with a good way to test this theory, however. Any thoughts on that are welcome as well.
The last error in the log is UnityEngine.TextGenerator:Populate_Internal_Injected plus a bunch of memory locations.
Thanks in advance!
Update: I can successfully print the value of NEW to the console right before I try and update the text box which still causes the game to crash, which disproves my theory about async being the cause. Still looking for suggestions if anyone has any or has seen this error message before. Thanks!
Your answer
