A Unity Package containing all the necessary components to do VR networking with Photon Fusion
NOTE: FusionVR is still in beta, bugs, issues, unfinished features and such are to be expected.
The recommended Unity version is 2021.3.25.1.
You need the Photon Fusion SDK and Photon Voice installed to proceed.
If you are having trouble with Voice, please read Fusion Voice Intergration Docs
Start off by finding the player in the Resources folder, press on it and you'll be met with this dialog.
Press Import TMP Essentials.
After that navigate to Resources/FusionVR/Prefabs.
Then drag FusionVRManager into your scene. There should only be 1 manager in the entire game. The manager will therefore mark itself your player as "DontDestroyOnLoad". The manager will automatically attempt to fill out the required fields
Including Fusion.VR
using Fusion.VR
Connecting to servers
FusionVRManager.Connect();
Joining rooms
// It will only join people on the same queue but the room codes themselves are random
string queue = "Space";
// Optional
int maxPlayers = 100;
FusionVRManager.JoinRandomRoom(queue, maxPlayers);
Joining private rooms
string roomCode = "1234";
// Optional
int maxPlayers = 100;
FusionVRManager.JoinPrivateRoom(roomCode, maxPlayers);
Leaving the current room
FusionVRManager.LeaveRoom();
Setting name
FusionVRManager.SetUsername("fchb1239");
Setting colour
Color myColour = new Color(0, 0, 1);
FusionVRManager.SetColour(myColour);
Cosmetics in Fusion VR Work differently to Photon VR. In Fusion, cosmetics are stored as a dictionary, with the slot name, and the cosmetic name.
Start off by locating "Cosmetic Slots" on the manager.
Here you can add or remove slots.
Navigate to the player in Resources/FusionVR, here you can add the cosmetic slot parents.
A cosmetic slot parent, is the parent of all the comsetics in that slot.
Under a parent, you make the cosmetics. Set the GameObject/cosmetic name to something under 32 characters.
Enabling a cosmetic
string SlotName = "Head";
string CosmeticName = "VRTopHat"; // VRTopHat is one of the 4 default cosmetics
FusionVRManager.SetCosmetics(SlotName, CosmeticName);
Enabling a list cosmetic
Dictionary<string, string> Cosmetics = new Dictionary<string, string>();
Cosmetics.Add("Head", "VRTopHat");
Cosmetics.Add("Face", "VRSunglasses");
FusionVRManager.SetCosmetics(Cosmetics);
Small note: Some functions are async, they may cause warnings but don't worry about them. If you have your own async function, you can await them. Have fun devs!