Quantcast
Channel: Unity Forum
Viewing all articles
Browse latest Browse all 1466670

Object reference not set when referencing it and adding to array

$
0
0
Hi.
I am attempting to generate a grid and storing the individual Tiles in a 2 dimensional array. But as soon as I am attempting to access the the tiles in the array I get a "null reference exception" Bellow I have included some of the code, if someone could tell me what I'm doing wrong.

Strip down grid generation script
Code (CSharp):
  1. public class Grid : MonoBehaviour
  2. {
  3.     public Tile[,] Map;
  4.  
  5.     public int gridWidthInHexes = 10;
  6.     public int gridHeightInHexes = 10;
  7.  
  8.     private void...
Object reference not set when referencing it and adding to array

Viewing all articles
Browse latest Browse all 1466670

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>