- Home /
Question by
Christian.Tucker · Oct 16, 2014 at 07:07 AM ·
c#gui
UnassignedReferenceException: But wait; It's there!
Perhaps this is a bug to do with the new UI, but I have a prefab that contains a bunch of buttons on it which is a bar for a table. Basically I'm trying to instantiate the Panel. This however is giving me some very strange errors.
The prefab is more than definitely set in the inspector; So I did some digging around to make sure that I didn't have to instances of the script anywhere. I'm not sure what's going on.. Why dis happen 2 me?
Also: using
ServerBar = (GameObject)Resources.Load ("ServerBar");
returns null, but the prefab is definately valid, if I drag it onto the scene it works perfectly.
Comment
Do you define the variable somewhere? like
GameObject ServerBar = null;
ServerBar = something et.c.
or
GameObject ServerBar = (GameObject)Resources.Load ("ServerBar");
Looking at Unity's Resouces.Load is also looks like you need to supply the resource type too,.. eg.
ServerBar = (GameObject)Resources.Load ("ServerBar", typeof(GameObject));
Your answer
![](https://koobas.hobune.stream/wayback/20220613165213im_/https://answers.unity.com/themes/thub/images/avi.jpg)