"LoadAll can only be called from the main thread.

So I’ve been trying to make an inventory. I’ve followed this [series][1] from part 30. I’s going well and I’m understanding a lot of it but when I get to part 32 on making the textures load automatically load I get the error “LoadAll can only be called from the main thread.”

Here is the code:

#pragma strict

//Items
static var itemID : String[] = ["Oak Wood", "Palm Wood", "Stone", "Iron Bar"];
static var itemPlayersAmount : int[] = [0, 0, 0, 0];
var itemTexture = new Texture[Player_Inventory.itemID.length];

//0 = Oak Wood
//1 = Palm Wood
//2 = Stone
//3 = Iron Bar

var textures : Object[] = Resources.LoadAll("Item_Icons", Texture2D);
for (var i = 0; i < textures.length; i++)
{
    itemTexture _= textures*;*_

}
_*[1]: Unity 3D Tutorial Part 32: Making New Items - YouTube

It’s been resolved. I forgot to put the whole thing into a function :stuck_out_tongue: