Need help with arrays on 2D Roguelike tutorial
Hello, I'm modifying the board manager code from lesson 5 of 2D Roguelike tutorial, using Unity 5.6.f2.
I'm trying to create a new array to split food into different types of foods, to have a better control of the randomized foodCount min and max values for each type of food.
I created:
public Count carboidratoCount = new Count (1, 3); public GameObject[] carboidratoTiles;
And at : public void SetupScene (int level)
I also created
LayoutObjectAtRandom (carboidratoTiles, carboidratoCount.minimum, carboidratoCount.maximum);
I created diferent prefabs for the carboidratoTiles too.
When I run the game, console gives me the following message: IndexOutOfRangeException: Array index is out of range. BoardManager.LayoutObjectAtRandom (UnityEngine.GameObject[] tileArray, Int32 minimum, Int32 maximum) (at Assets/Scripts/BoardManager.cs:116) BoardManager.SetupScene (Int32 level) (at Assets/Scripts/BoardManager.cs:136) GameManager.InitGame () (at Assets/Scripts/GameManager.cs:103) GameManager.Awake () (at Assets/Scripts/GameManager.cs:50) UnityEngine.Object:Instantiate(GameObject) Loader:Awake() (at Assets/Scripts/Loader.cs:17)
I tried to solve it, but I have no idea where to go or what to do.
Your answer

Follow this Question
Related Questions
Looking for a turn-based strategy beginner's tutorial. 5 Answers
Tutorial level 1 Answer
2D Rougelike Tutorial-Part 13 -Music Will Not Play 0 Answers
Best waybto make in game tutorial 1 Answer