Skip to content
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

CyanEmu Udon emulation does not respect private methods #51

Open
RedSpeeds opened this issue Oct 10, 2021 · 4 comments · May be fixed by #53
Open

CyanEmu Udon emulation does not respect private methods #51

RedSpeeds opened this issue Oct 10, 2021 · 4 comments · May be fixed by #53

Comments

@RedSpeeds
Copy link

Hey there while debugging i noticed a bug that cyanemu executes methods prefixed with an underscore when they are ran thru sendcustomnetwork event this is in my opinion unwanted behavior the excepted behavior would be for cyanemu to throw an error stating methods prefixed with an underscore cannot be executed over the network.

@CyanLaser
Copy link
Owner

This is an issue with the vrchat sdk itself and is not something CyanEmu can change without modifying the sdk.

https://vrchat.canny.io/vrchat-udon-closed-alpha-bugs/p/sdk-202106031457-sendcustomnetworkevent-executes-events-that-start-with-an-under

@RedSpeeds
Copy link
Author

I see would i be possible to write a SDK edit similar to the one that was made for SDK2 triggers

@CyanLaser
Copy link
Owner

Open UdonBehaviour.cs, find the SendCustomNetworkEvent method, and remove the editor only code. CyanEmu will then handle ignoring networked events that start with an underscore.

By default, it will look like this:

public override void SendCustomNetworkEvent(NetworkEventTarget target, string eventName)
{
#if UNITY_EDITOR
    SendCustomEvent(eventName);
#else
    SendCustomNetworkEventHook?.Invoke(this, target, eventName);
#endif
}

Change it to look like this:

public override void SendCustomNetworkEvent(NetworkEventTarget target, string eventName)
{
    SendCustomNetworkEventHook?.Invoke(this, target, eventName);
}

RedSpeeds added a commit to RedSpeeds/CyanEmu that referenced this issue Oct 15, 2021
Updated modifications so it will patch UdonBehavior to respect private methods if in editor mode
RedSpeeds added a commit to RedSpeeds/CyanEmu that referenced this issue Oct 15, 2021
Modified modifications.txt to include patch to UdonBehavior to respect private udon methods
Fixes CyanLaser#51
@RedSpeeds RedSpeeds linked a pull request Oct 15, 2021 that will close this issue
@RedSpeeds
Copy link
Author

Took me a while to find the time to write these changes but here you go :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants