Script QoL fixes

This commit is contained in:
raccoon
2025-10-06 09:21:15 +05:00
parent 517171a8bc
commit cccf26db9a
2 changed files with 47 additions and 19 deletions

View File

@@ -12,7 +12,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: c333ccfdd0cbdbc4ca30cef2dd6e6b9b, type: 3}
m_Name: GenericDoor
m_EditorClassIdentifier:
serializedUdonProgramAsset: {fileID: 11400000, guid: 6fa477c5beb3c7e43b8ac3581c58e13d,
serializedUdonProgramAsset: {fileID: 11400000, guid: 1297955593892ab40bd94f2d61c41be6,
type: 2}
udonAssembly:
assemblyError:
@@ -86,7 +86,16 @@ MonoBehaviour:
Data: 4|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
Data: 1
- Name:
Entry: 7
Data: 5|UnityEngine.TooltipAttribute, UnityEngine.CoreModule
- Name: tooltip
Entry: 1
Data: Put your "Door" object with animator component here
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:
@@ -107,13 +116,13 @@ MonoBehaviour:
Data: isOpen
- Name: $v
Entry: 7
Data: 5|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 6|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: isOpen
- Name: <UserType>k__BackingField
Entry: 7
Data: 6|System.RuntimeType, mscorlib
Data: 7|System.RuntimeType, mscorlib
- Name:
Entry: 1
Data: System.Boolean, mscorlib
@@ -122,7 +131,7 @@ MonoBehaviour:
Data:
- Name: <SystemType>k__BackingField
Entry: 9
Data: 6
Data: 7
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -137,19 +146,28 @@ MonoBehaviour:
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 7|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 8|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 2
Data: 3
- Name:
Entry: 7
Data: 8|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
Data: 9|UnityEngine.TooltipAttribute, UnityEngine.CoreModule
- Name: tooltip
Entry: 1
Data: Start state of the "Door" (parameter 'isOpen' in controller)
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data: 9|UdonSharp.FieldChangeCallbackAttribute, UdonSharp.Runtime
Data: 10|UdonSharp.UdonSyncedAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
- Name:
Entry: 7
Data: 11|UdonSharp.FieldChangeCallbackAttribute, UdonSharp.Runtime
- Name:
Entry: 8
Data:
@@ -173,16 +191,16 @@ MonoBehaviour:
Data: reverse
- Name: $v
Entry: 7
Data: 10|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
Data: 12|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor
- Name: <Name>k__BackingField
Entry: 1
Data: reverse
- Name: <UserType>k__BackingField
Entry: 9
Data: 6
Data: 7
- Name: <SystemType>k__BackingField
Entry: 9
Data: 6
Data: 7
- Name: <SyncMode>k__BackingField
Entry: 7
Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib
@@ -197,10 +215,19 @@ MonoBehaviour:
Data: true
- Name: _fieldAttributes
Entry: 7
Data: 11|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
Data: 13|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib
- Name:
Entry: 12
Data: 0
Data: 1
- Name:
Entry: 7
Data: 14|UnityEngine.TooltipAttribute, UnityEngine.CoreModule
- Name: tooltip
Entry: 1
Data: The "Door" opens from the other side (parameter 'reverse' in controller)
- Name:
Entry: 8
Data:
- Name:
Entry: 13
Data:

View File

@@ -1,14 +1,15 @@
using UdonSharp;
using UdonSharp;
using UnityEngine;
using VRC.SDKBase;
[UdonBehaviourSyncMode(BehaviourSyncMode.Manual)]
public class GenericDoor : UdonSharpBehaviour
{
[Tooltip("Put your \"Door\" object with animator component here")]
public Animator animator;
[UdonSynced, FieldChangeCallback(nameof(IsOpen))]
public bool isOpen;
[Tooltip("Start state of the \"Door\" (parameter \'isOpen\' in controller)"), UdonSynced, FieldChangeCallback(nameof(IsOpen))]
public bool isOpen = false;
[Tooltip("The \"Door\" opens from the other side (parameter \'reverse\' in controller)")]
public bool reverse = false;
public bool IsOpen
@@ -30,7 +31,7 @@ public class GenericDoor : UdonSharpBehaviour
void Start()
{
animator.SetBool("isOpen", isOpen);
SetAnimatorValue(isOpen);
}
private void SetAnimatorValue(bool value)