I am making a loot system that sends an icon from the loot generation script to the loot script attached to an enemy, the icon is then supposed to appear on the loot screen when the enemy has been killed.
The problem is that the icon is not appearing.
What am I doing wrong here?
LootGenerate.js:
var itemList1 : GameObject[]; //List of items to choose from (there will only ever be 2 items to choose from)
var itemList : GameObject[]; //List of items to choose from for the second item listed
function Loot1 () { //This function is called when the enemy dies
for (var item1 : GameObject in itemList1) { //A random item in the first list
var icon1 = item1.GetComponent(Texture); //The items icon element
SendMessage ("FirstItem", icon1); //The icon is sent over to the loot script
}
}
function Loot () { //This function is also called when the enemy dies
for (var item : GameObject in itemList) { //A random item in the second list for the second item on the loot screen
var icon = item.GetComponent(Texture); //The items icon texture
SendMessage ("SecondItem", icon); //The second icon is sent over to the loot script
}
}
You should post also the receiving script. Pretty hard to tell what is causing this to malfunction when we don’t see script that you send the information to