mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2024-12-28 10:15:06 +08:00
fix: issues when handling VRCExpressionMenus with an uninitialized type field (#1303)
This commit is contained in:
parent
123523540e
commit
11a62c88d4
@ -301,10 +301,9 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
EditorGUILayout.BeginVertical();
|
||||
|
||||
if (_type.hasMultipleDifferentValues) return;
|
||||
VRCExpressionsMenu.Control.ControlType type =
|
||||
(VRCExpressionsMenu.Control.ControlType) Enum
|
||||
.GetValues(typeof(VRCExpressionsMenu.Control.ControlType))
|
||||
.GetValue(_type.enumValueIndex);
|
||||
var controlTypeArray = Enum.GetValues(typeof(VRCExpressionsMenu.Control.ControlType));
|
||||
var index = Math.Clamp(_type.enumValueIndex, 0, controlTypeArray.Length - 1);
|
||||
var type = (VRCExpressionsMenu.Control.ControlType)controlTypeArray.GetValue(index);
|
||||
|
||||
switch (type)
|
||||
{
|
||||
|
@ -119,9 +119,11 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
|
||||
internal static VRCExpressionsMenu.Control CloneControl(VRCExpressionsMenu.Control c)
|
||||
{
|
||||
var type = c.type != 0 ? c.type : VRCExpressionsMenu.Control.ControlType.Button;
|
||||
|
||||
return new VRCExpressionsMenu.Control()
|
||||
{
|
||||
type = c.type,
|
||||
type = type,
|
||||
name = c.name,
|
||||
icon = c.icon,
|
||||
parameter = new VRCExpressionsMenu.Control.Parameter() { name = c.parameter?.name },
|
||||
|
Loading…
Reference in New Issue
Block a user