Skip to content

Commit 9bfda3c

Browse files
committed
Remove uses of IsValid because null checks work
These were used because null checks on UnityEngine.Objects were broken, but this bug has been fixed for a year+ and these calls cause ambiguity and failed compiles in any projects with ShaderGraph imported because Unity made the very poor choice to name a top level namespace 'Utilities'
1 parent 37e1d17 commit 9bfda3c

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

Assets/USharpVideo/Scripts/USharpVideoPlayer.cs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1476,9 +1476,9 @@ public void UnregisterScreenHandler(VideoScreenHandler screenHandler)
14761476
}
14771477
}
14781478

1479-
Texture _lastAssignedRenderTexture;
1479+
private Texture _lastAssignedRenderTexture;
14801480

1481-
void UpdateRenderTexture()
1481+
private void UpdateRenderTexture()
14821482
{
14831483
if (_registeredScreenHandlers == null)
14841484
return;
@@ -1490,8 +1490,10 @@ void UpdateRenderTexture()
14901490

14911491
foreach (VideoScreenHandler handler in _registeredScreenHandlers)
14921492
{
1493-
if (Utilities.IsValid(handler))
1493+
if (handler)
1494+
{
14941495
handler.UpdateVideoTexture(renderTexture, IsUsingAVProPlayer());
1496+
}
14951497
}
14961498

14971499
_lastAssignedRenderTexture = renderTexture;
@@ -1509,7 +1511,7 @@ void UpdateRenderTexture()
15091511
[PublicAPI]
15101512
public void RegisterCallbackReceiver(UdonSharpBehaviour callbackReceiver)
15111513
{
1512-
if (!Utilities.IsValid(callbackReceiver))
1514+
if (!callbackReceiver)
15131515
return;
15141516

15151517
if (_registeredCallbackReceivers == null)
@@ -1531,7 +1533,7 @@ public void RegisterCallbackReceiver(UdonSharpBehaviour callbackReceiver)
15311533
[PublicAPI]
15321534
public void UnregisterCallbackReceiver(UdonSharpBehaviour callbackReceiver)
15331535
{
1534-
if (!Utilities.IsValid(callbackReceiver))
1536+
if (!callbackReceiver)
15351537
return;
15361538

15371539
if (_registeredCallbackReceivers == null)
@@ -1559,11 +1561,11 @@ public void UnregisterCallbackReceiver(UdonSharpBehaviour callbackReceiver)
15591561
}
15601562
}
15611563

1562-
void SendCallback(string callbackName)
1564+
private void SendCallback(string callbackName)
15631565
{
15641566
foreach (UdonSharpBehaviour callbackReceiver in _registeredCallbackReceivers)
15651567
{
1566-
if (Utilities.IsValid(callbackReceiver))
1568+
if (callbackReceiver)
15671569
{
15681570
callbackReceiver.SendCustomEvent(callbackName);
15691571
}

Assets/USharpVideo/Scripts/VideoControlHandler.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using UnityEngine.UI;
66
using VRC.SDK3.Components;
77
using VRC.SDKBase;
8-
using VRC.Udon;
98

109
namespace UdonSharp.Video
1110
{
@@ -130,7 +129,7 @@ void UpdateMaster()
130129
if (masterField)
131130
{
132131
VRCPlayerApi owner = Networking.GetOwner(gameObject);
133-
if (Utilities.IsValid(owner))
132+
if (owner != null && owner.IsValid())
134133
masterField.text = Networking.GetOwner(gameObject).displayName;
135134
}
136135
#endif

0 commit comments

Comments
 (0)