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

Trying to modify a matrix in class

$
0
0
Hi everyone,
I'm actually working in a script including a class whith a matrix of int as internal variable.

Here a compacted code:

Code (JavaScript):
  1. function Start () {
  2.  
  3. var test = new Ctest();
  4.  
  5. }
  6.  
  7. function Update () {
  8.  
  9. }
  10.  
  11.  
  12. class Ctest{
  13.  
  14.     var mat:int[,];
  15.  
  16.     function Ctest(){
  17.  
  18.         mat[0,0]=0;
  19.        
  20.     }
  21. }
When I assign 0 to mat[0,0] I get an error: NullReferenceException: Object reference not set to an instance of the object.

Thank you for your help.

Viewing all articles
Browse latest Browse all 1466670

Trending Articles