Skip to content

Commit 6bfab05

Browse files
committed
Fix callback initialization order issue and simplify URL button example
1 parent 14648a3 commit 6bfab05

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

Assets/USharpVideo/Examples/Scripts/PlayURLButton.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,7 @@ void Start()
2929

3030
public void OnButtonPress()
3131
{
32-
if (targetVideoPlayer.CanControlVideoPlayer())
33-
{
34-
targetVideoPlayer.TakeOwnership();
35-
targetVideoPlayer.PlayVideo(url);
36-
}
32+
targetVideoPlayer.PlayVideo(url);
3733
}
3834

3935
public void OnUSharpVideoLockChange()

Assets/USharpVideo/Scripts/USharpVideoPlayer.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ void Start()
164164
if (_registeredControlHandlers == null)
165165
_registeredControlHandlers = new VideoControlHandler[0];
166166

167-
_registeredCallbackReceivers = new UdonSharpBehaviour[0];
167+
if (_registeredCallbackReceivers == null)
168+
_registeredCallbackReceivers = new UdonSharpBehaviour[0];
168169

169170
if (Networking.IsOwner(gameObject))
170171
{

0 commit comments

Comments
 (0)