NOTE: 2D game here with C#. So I have this error: IndexOutOfRangeException: Array index is out of range. JudaiCoinScript.Spawn () (at Assets/Scripts/Messenger/JudaiCoinScript.cs:52) JudaiCoinScript.Start () (at Assets/Scripts/Messenger/JudaiCoinScript.cs:18)
and I’m trying to figure out what’s causing it. I did some research trying to find a solution to my error and I found out some things, but they were not quite helpful in my situation. Here’s my script(WARNING long script, if you are afraid of long scripts please do not click the link): http://pastebin.com/bAVVnsKX
Okay so now the errors appear in two places on the script. The first is where the void Spawn(){ is at, right under it is where the error is at, where it says “Instantiate (obj [Random.Range (0, obj.GetLength (0))], transform.position, Quaternion.identity);”.
The second error is located right under the void Start(){ where it says “Spawn();”. Now as you can tell(if you clicked the link) the code is very inefficient and needs to be cut down. It’s so large because I combined another spawn script with it because it wasn’t working by itself. Anyways please help if you can or if you want to(I mean who would want to help a random guy). Most of you people though are very generous, so thanks you.
And multiple tags are still not working for me. I guess I’m limited to only 1.