Search Unity

instance

Discussion in 'Scripting' started by BlueMumm, Mar 4, 2008.

  1. BlueMumm

    BlueMumm

    Joined:
    Feb 7, 2008
    Posts:
    43
    I'm trying to use a array its at the top of the script. It keeps telling me I need instance of the script to use the array doesnt it automatically have a instance for the script. I know in C++ in a class you have a instance of that class just wondering how it works with Javascript
     
  2. NYGhost

    NYGhost

    Joined:
    Sep 20, 2007
    Posts:
    55
    this is the way I create my arrays
    Code (csharp):
    1. public var  myArray: Array = new Array();
     
  3. HiggyB

    HiggyB

    Unity Product Evangelist

    Joined:
    Dec 8, 2006
    Posts:
    6,183
    And if the advice above doesn't help perhaps you can clarify what it is you're trying to achieve, maybe even post some code. For example, are you defining your own class or writing a component script?
     
  4. BlueMumm

    BlueMumm

    Joined:
    Feb 7, 2008
    Posts:
    43
    The problem i just found out was that i was trying use the array inside of a static function which Im guessing that I could not do so I just worked around it.