Search Unity

Code problem Class

Discussion in 'Scripting' started by snortop, Mar 8, 2012.

  1. snortop

    snortop

    Joined:
    Dec 16, 2011
    Posts:
    194
    I usually code in Javascript.

    So having a bit of trouble whit this.
    Hope someone can help me whit it

    This code.
    javascript
    Code (csharp):
    1.  
    2. var info : SaveInfo[];
    3.  
    4. class SaveInfo {
    5.     var Name : String;
    6.     var Age  : int;
    7. }
    8.  
    When putting onto a object it show in the inspector whit a variable and you can add more to the info.

    Now i convert it to C# like this.

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. public class testc : MonoBehaviour {
    6.     public SaveInfo info;
    7.    
    8.     class SaveInfo {
    9.         string Name;
    10.         int Age;
    11.     }
    12. }
    13.  
    But that dont even show up in the inspector for me or can i add the [].

    So have to do it?
     
    Last edited: Mar 13, 2012
  2. snortop

    snortop

    Joined:
    Dec 16, 2011
    Posts:
    194