Search Unity

C# Noob Question

Discussion in 'Scripting' started by Mortoc, Nov 3, 2006.

  1. Mortoc

    Mortoc

    Joined:
    Nov 3, 2006
    Posts:
    50
    How do I make C# member variables accessible to the "Default Properties" window in the editor? This code doesn't do the trick:

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. public class HeightmapTerrain : MonoBehaviour
    6. {
    7.     public Vector3 mSize;
    8.     public Texture2D mHeightMap;
    9.     public Material mMaterial;
    10.    
    11.     public uint mVertexResolution = 1024;
    12.  
    13.     // et cetera
    14. }
    15.  
    16.  
    Thanks.
     
  2. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    The default properties only shows references to other objects. Eg.

    public Texture2D mHeightMap;

    But not floats or other variables which can have a default value set in the script.

    If you want to see mVertexResolution in the inspector when attaching the script to a game object then you should make it an int instead of uint:
    Code (csharp):
    1.  
    2. public int mVertexResolution = 1024;
    3.