Text Object defaulting to previous value.

I’m trying to add the ability for my users to add notes. I have a list of Note Objects which are basically a string for the note, and an id for what note it is.

When I load my menu, I check my notes list and if the ID matches, it loads the note into the Text objects text property just fine. However, when I set the default menu as inactive and set the notes menu as active, it always defaults the text property back to whatever it was previously, even though it’s value is correct before I make it active…

I’ve tried a few different ways to code how this text is set, but no matter what I do I have the same issue. Is this a Unity querk?

So figured it out… If anyone finds this and needs an answer you need to change the text of the parent InputField object and not the child text object of the input field.

So where I had a public Text object, I changed it to an InputField and now everything is working great :slight_smile:

Might be easier to find the problem if you show the code thats enabling, disabling and setting the Note GUI Text. Outside of that, One thing you need to note is that if an object is Inactive, methods like FindGameObjectsWithTag won’t be able to find it and therefore set it’s text, due to it not being active in the scene. To get around that, you either need to set it in the editor, or just need to have everything enabled on Awake, then disable it as soon as the reference is set.


Again, not sure that’s your issue, but it’s hard to see the problem when you only show what it Should be doing and not what the code is actually doing.