Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Problem with accessing array between scripts...

Discussion in 'Scripting' started by Dinesh Balu, Apr 7, 2011.

  1. Dinesh Balu

    Dinesh Balu

    Joined:
    Mar 10, 2011
    Posts:
    255
    Hi...

    I have two scripts running in two different scene one after another.. I have some variables and a String array variable in the first script ,which I want to use in the second script.

    In the second script, when I access the String array variable,It says NullReference error... but I can access other variables from the same script. All the variables including the String Array are declared with public static keyword... The error is for the particular string array only... what would be the problem... someone help please.... :-|
     
  2. Marrrk

    Marrrk

    Joined:
    Mar 21, 2011
    Posts:
    1,032
    Looks like you try to access your array before its initialized.

    Code?
     
  3. Dinesh Balu

    Dinesh Balu

    Joined:
    Mar 10, 2011
    Posts:
    255
    Yeah.... I just only checked it.... I wrote some code to assign it,... but the execution is not entering into the block... I'm checking on it...

    Thanks for the reply Marrrk.... :)