- Home /
Calling a void from another script Unexpected "String"
Ok So i have this string in store with (string, int, int, int) and I am trying to RUN this from another script and assign Values to these. getting: error CS1525: Unexpected symbol ItemTOUnlock', expecting
.'
public void OpenLootBronze(){
int RAND;
RAND = Random.Range (0, 90);
if(RAND >0 && RAND < 5){ // Rarest Item:
Store.UnlockBronze(string ItemTOUnlock = "BLAH" , int Loot = 1, int Ammount = 0, int Amount2 = 0);
}
}
// in "STORE" Script
static public void UnlockBronze(string ItemTOUnlock, int Loot, int Ammount, int Amount2, int LVLUp){
// Do Stuff
}
Comment
Answer by allenallenallen · May 28, 2017 at 03:15 AM
This is wrong:
Store.UnlockBronze(string ItemTOUnlock = "BLAH" , int Loot = 1, int Ammount = 0, int Amount2 = 0);
You are only supposed to pass values in parameters.
Store.UnlockBronze("BLAH", 1, 0, 0);
Or if you have already declared the variables beforehand:
string ItemTOUnlock = "BLAH";
int Loot = 1;
int Ammount = 0;
int Amount2 = 0;
Store.UnlockBronze(ItemTOUnlock, Loot, Ammount, Amount2);
Learn some C# syntax to avoid this kind of problem.