Skip to content

Commit 9467d0f

Browse files
committed
Fix minor things
- Move UI update to Update from LateUpdate to avoid behaviour crashing when you leave the world because Udon doesn't shut down properly. - Silence warning on a field on USharpVideoPlayer - Make the video player inspector change the default slider value on video players and record prefab modifications correctly
1 parent c99d158 commit 9467d0f

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

Assets/USharpVideo/Scripts/Editor/USharpVideoInspector.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,23 @@ public override void OnInspectorGUI()
9393
Undo.RecordObject(source, "Change audio properties");
9494
source.maxDistance = Mathf.Max(0f, audioRangeProperty.floatValue);
9595
source.volume = defaultVolumeProperty.floatValue;
96+
97+
if (PrefabUtility.IsPartOfPrefabInstance(source))
98+
PrefabUtility.RecordPrefabInstancePropertyModifications(source);
99+
}
100+
}
101+
102+
VolumeController[] volumeControllers = ((Component)target).GetUdonSharpComponentsInChildren<VolumeController>(true);
103+
104+
foreach (VolumeController controller in volumeControllers)
105+
{
106+
if (controller.slider)
107+
{
108+
Undo.RecordObject(controller.slider, "Change audio properties");
109+
controller.slider.value = defaultVolumeProperty.floatValue;
110+
111+
if (PrefabUtility.IsPartOfPrefabInstance(controller.slider))
112+
PrefabUtility.RecordPrefabInstancePropertyModifications(controller.slider);
96113
}
97114
}
98115
}

Assets/USharpVideo/Scripts/USharpVideoPlayer.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,11 @@ public class USharpVideoPlayer : UdonSharpBehaviour
4040
[SerializeField]
4141
float defaultVolume = 0.5f;
4242

43-
[Tooltip("The max range of the audio sources")]
43+
#pragma warning disable CS0414
44+
[Tooltip("The max range of the audio sources on this video player")]
4445
[SerializeField]
4546
float audioRange = 40f;
47+
#pragma warning restore CS0414
4648

4749
/// <summary>
4850
/// Local offset from the network time to sync the video

Assets/USharpVideo/Scripts/VideoControlHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public override bool OnOwnershipRequest(VRCPlayerApi requestingPlayer, VRCPlayer
107107
return false;
108108
}
109109

110-
private void LateUpdate()
110+
private void Update()
111111
{
112112
RunUIUpdate();
113113
}

0 commit comments

Comments
 (0)