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

Rpccall callback is called even if it is not registered #92

Open
SaadBazaz opened this issue Oct 7, 2024 · 0 comments
Open

Rpccall callback is called even if it is not registered #92

SaadBazaz opened this issue Oct 7, 2024 · 0 comments
Assignees

Comments

@SaadBazaz
Copy link
Collaborator

SaadBazaz commented Oct 7, 2024

What happened?

public void RegisterRpcShoot()
    {
        PlayroomKit.RpcRegister("ShootLaser", HandleScoreUpdate, "You shot a bullet!");
        Debug.Log($"Shoot function registered");
    }

This is the register if you dont press register first the handlescoreupdate function is not called
so the score is not updated

but the code inside the closure is still called:

   public void ShootLaser()
    {
            var myPlayer = PlayroomKit.MyPlayer();
            var index = players.IndexOf(myPlayer);
            score = playerGameObjects[index].GetComponent<RaycastGun>().ShootLaser(score);
            PlayroomKit.RpcCall("ShootLaser", score, PlayroomKit.RpcMode.OTHERS,  () =>
            {
                Debug.Log("Shooting bullet");
            });
    }

Version

0.0.31beta

What is your environment?

No response

Link to original discussion

https://discord.com/channels/867124708473700363/1234388527823982695/1292794001371566090

Relevant log output

@SaadBazaz SaadBazaz converted this from a draft issue Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Ready
Development

No branches or pull requests

2 participants