I have two scripts. One is the PlayerVerbs and the other is DoorToggle. In PlayerVerb I have a macro to open and close door by using a macro. In DoorToggle I assigned a UI text and a boolean. The boolean is to switch whether or not the door is open. If it is open, I send a message to the text that the player can closed the door and vice versa. In PlayerVerbs I access DoorToggle's boolean by using Door.GetComponent().DoorToggleSendMessage(); It works, but the problem is somewhere along the line, if I assigned the text in the DoorToggleSendMessage class, it somehow lose it reference point. Why is that? What can I do to fix this?
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
3 People are following this question.
How to render text on top of the objects that are generated on the map using a script?
problem with Adjustable Character Spacing script in Unity 5.4
How do I keep two UI text unity3d on the scene
UI Text created from C# Script
Change UI Text in script