- Home /
Missing Reference Exception @ GuiSkin...Gui Button
Hello Unityrs, I have the following function which is called by the OnGUI one. The Compiler returns me this message: "MissingReferenceException: The object of type 'Texture2D' has been destroyed but you are still trying to access it. Your script should either check if it is null or you should not destroy the object." in correspondance of the IF, but I can't figure out...what does that mean.
function GlobalChatWindow (id : int) {
var closeButtonStyle = GUI.skin.GetStyle("close_button");
if (GUI.Button(Rect (4, 4, closeButtonStyle.normal.background.width, closeButtonStyle.normal.background.height), "", "close_button")) { CloseChatWindow(); } ...
Any help!? :) Thanks !
Answer by GurtejKanwar · Jun 14, 2012 at 04:01 PM
It sounds like your skin doesn't have a "close_button" style. This causes it to return a null pointer, which gives you a NullReferenceException when you try to access it.
Your answer
Follow this Question
Related Questions
Unassigned Reference Exception ? 0 Answers
Do I NEED to handle the MissingReferenceException? 1 Answer
NullReferenceException Error 6 Answers