Skip to main content

CRZ_Network

CRZ_Network is a small static class with networking helpers used across the CrZVRC assets: a safe ownership transfer and a shortcut for looking up a player's display name by id.

public static class CRZ_Network

Methods​

SetOwnership​

Transfers ownership of gameobject to player, but only when player is not already the owner. This avoids redundant Networking.SetOwner calls.

public static void SetOwnership(VRCPlayerApi player, GameObject gameobject)

Parameters:

ParameterTypeDescription
playerVRCPlayerApiThe player that should own the object.
gameobjectGameObjectThe object whose ownership should be updated.

GetPlayerName​

Returns the display name of the player with the given player id.

public static string GetPlayerName(int playerId)

Parameters:

ParameterTypeDescription
playerIdintThe VRChat player id to look up.

Returns: The player's displayName, or an empty string "" if no player with playerId is currently in the instance.