Skip to content

Fix SendCustomEventDelayedSeconds and SendCustomEventDelayedFrames in play mode #146

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions Packages/com.vrchat.UdonSharp/Runtime/UdonSharpBehaviour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,13 @@ public void SendCustomNetworkEvent(NetworkEventTarget target, string eventName)
/// <param name="delaySeconds"></param>
/// <param name="eventTiming"></param>
[PublicAPI]
public void SendCustomEventDelayedSeconds(string eventName, float delaySeconds, VRC.Udon.Common.Enums.EventTiming eventTiming = VRC.Udon.Common.Enums.EventTiming.Update) { }
public void SendCustomEventDelayedSeconds(string eventName, float delaySeconds, VRC.Udon.Common.Enums.EventTiming eventTiming = VRC.Udon.Common.Enums.EventTiming.Update)
{
#if UNITY_EDITOR
if (_udonSharpBackingUdonBehaviour != null && Application.isPlaying)
UdonManager.Instance.ScheduleDelayedEvent(_udonSharpBackingUdonBehaviour, eventName, delaySeconds, eventTiming);
#endif
}

/// <summary>
/// Executes target event after delayFrames have passed. If 0 frames is specified, will execute the following frame. In effect 0 frame delay and 1 fame delay are the same on this method.
Expand All @@ -120,7 +126,13 @@ public void SendCustomEventDelayedSeconds(string eventName, float delaySeconds,
/// <param name="delayFrames"></param>
/// <param name="eventTiming"></param>
[PublicAPI]
public void SendCustomEventDelayedFrames(string eventName, int delayFrames, VRC.Udon.Common.Enums.EventTiming eventTiming = VRC.Udon.Common.Enums.EventTiming.Update) { }
public void SendCustomEventDelayedFrames(string eventName, int delayFrames, VRC.Udon.Common.Enums.EventTiming eventTiming = VRC.Udon.Common.Enums.EventTiming.Update)
{
#if UNITY_EDITOR
if (_udonSharpBackingUdonBehaviour != null && Application.isPlaying)
UdonManager.Instance.ScheduleDelayedEvent(_udonSharpBackingUdonBehaviour, eventName, delayFrames, eventTiming);
#endif
}

/// <summary>
/// Disables Interact events on this UdonBehaviour and disables the interact outline on the object this is attached to
Expand Down