Resources.Load happening asynchronously when it shouldn't
Hi i'm trying to Instantiate a prefab i have. It loads perfectly with no issues, but for some reason trying to reference it immediately after returns an error Unassigned Reference Exception. If i just instantiate the prefab and leave it alone it loads into the scene perfectly fine, but for some reason trying to reference it on startup is an issue, as if it hasn't fully loaded by that time.
var panel = Instantiate (Resources.Load ("UI/InventoryPanel") as GameObject);
panel.testMethod(); //error here
the resource absolutely exists, because it ends up loading in-game, but attempting to call a method on it immediately after the game acts like it doesn't fully exist yet. When i call it at a different time, like 0.1 seconds later, the method works fine, returning the values i want
I have a hunch that Resource.Load is happening asynchronously. I don't really want it to do that, but it seems like that's whats happening. Is there a way to fix this?