Aller au contenu principal

For Developers

info

These docs were last updated for ValenCommons 2.10.0.

Runtime helpers use the valenvrc.Common namespace.

ArrayHelper​

T[] AddToList<T>(T[] list, T item, out string result)
bool Contains<T>(T[] array, T item)
T[] RemoveFromList<T>(T[] list, T item, out string result, bool shrink = false)
string[] SanitizeStringArray(string[] input, bool trimWhitespace = true)

AddToList avoids duplicates. RemoveFromList can preserve the original array size or shrink it. SanitizeStringArray removes empty entries and optionally trims whitespace.

Other helpers​

string Utility.GetColorHex(Color color)
void CustomLogger.Log(string prefix, string message)
void CustomLogger.Log(string prefix, string message, DebugMode logType)

Inspector attributes​

FoldoutSectionAttribute and ReorderableListAttribute work with the shared ValenCommons UdonSharp inspector.

[FoldoutSection("Audio")]
[SerializeField] private AudioClip sound;

[ReorderableList("Target-Method Pairs", "methodNames",
Labels = new[] { "Target", "Method" })]
[SerializeField] private UdonBehaviour[] targets;

[HideInInspector, SerializeField]
private string[] methodNames;

Additional arrays passed to ReorderableList are synchronized columns. Hide those backing fields so Unity does not draw them twice.