Search Unity

Arrays in the editor

Discussion in 'Scripting' started by AngryAnt, Nov 10, 2005.

  1. AngryAnt

    AngryAnt

    Keyboard Operator

    Joined:
    Oct 25, 2005
    Posts:
    3,045
    Hey ppl! I'd like to be able to edit a public array from the editor, but simply doing this (in C#) doesn't make the array available for editing in the properties editor:
    Code (csharp):
    1. public string[] myArray={"default element"};
     
  2. freyr

    freyr

    Joined:
    Apr 7, 2005
    Posts:
    1,148
    This is due to the current way we serialise .Net objects. This will be fixed in the upcoming 1.2 release of Unity.

    Currently you will have to store the data in some other way and then build the array in runtime.
     
  3. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    This will be supported with version 1.2
     
  4. AngryAnt

    AngryAnt

    Keyboard Operator

    Joined:
    Oct 25, 2005
    Posts:
    3,045
    /me waits for 1.2
     
  5. Jonathan Czeck

    Jonathan Czeck

    Joined:
    Mar 17, 2005
    Posts:
    1,713
    Does 1.2 support arrays of custom classes in the inspector? It'd be sweet if I could have for instance, an array of Frames for an animation system. The Frame class would include an index and a duration.

    I'm picturing it'd be similar to set up as the input axes in the Input Manager.

    -Jon
     
  6. AngryAnt

    AngryAnt

    Keyboard Operator

    Joined:
    Oct 25, 2005
    Posts:
    3,045
    If they implement arrays in the inspector, but limits the implementation to standard types only, I'll run over to their office and beat them insanely with my keyboard.

    AKA: I'm fairly sure they see no reason to limit the implementation to standard types.
     
  7. Jonathan Czeck

    Jonathan Czeck

    Joined:
    Mar 17, 2005
    Posts:
    1,713
    Don't hurt them!!

    I ask because currently custom structs don't show up in the inspector... for instance:

    Code (csharp):
    1.     public struct Fooo { float blah; }
    2.     public Fooo asdf;
    3.  
    -Jon
     
  8. AngryAnt

    AngryAnt

    Keyboard Operator

    Joined:
    Oct 25, 2005
    Posts:
    3,045
    /me juggles his keyboard a bit