I’m testing how array fields behave in UdonSharpBehaviour, using three basic types, int[], string[], and bool[], combined with different field attributes:
public, [HideInInspector] public, and [NonSerialized] public
When checking the object in Client Sim Udon Helper (a component automatically attached at runtime to the GameObject containing the corresponding UdonBehaviour) → Edit Public Variables during play mode,
I noticed that all of these arrays appear as if they have size = 1 and contain default values (0, empty string, false),
even though they are uninitialized and/or hidden in the Unity Inspector.
For reference, in Unity’s Inspector:
-
publicarrays are visible and look like empty arrays (size = 0), but they are not null at runtime.
-
[HideInInspector] publicarrays are hidden but still initialized (also not null). -
[NonSerialized] publicarrays are hidden and actually null at runtime.
Example
public
public class ArrayTest : UdonSharpBehaviour
{
public int[] IntArray;
public string[] StringArray;
public bool[] BoolArray;
private void Start()
{
Debug.Log(IntArray == null); // false
Debug.Log(StringArray == null); // false
Debug.Log(BoolArray == null); // false
}
}
[HideInInspector] public
public class ArrayTest : UdonSharpBehaviour
{
[HideInInspector] public int[] IntArray;
[HideInInspector] public string[] StringArray;
[HideInInspector] public bool[] BoolArray;
private void Start()
{
Debug.Log(IntArray == null); // false
Debug.Log(StringArray == null); // false
Debug.Log(BoolArray == null); // false
}
}
[NonSerialized] public
public class ArrayTest : UdonSharpBehaviour
{
[NonSerialized] public int[] IntArray;
[NonSerialized] public string[] StringArray;
[NonSerialized] public bool[] BoolArray;
private void Start()
{
Debug.Log(IntArray == null); // true
Debug.Log(StringArray == null); // true
Debug.Log(BoolArray == null); // true
}
}
Questions
- Why does Client Sim Udon Helper show all arrays as
size = 1even when they have not been initialized in Unity? - Why does
[NonSerialized]appear as a 1-element array in Client Sim Udon Helper, while beingnullat runtime (as shown above)?

