// When the game scene is loaded for the player public override bool OnLobbyServerSceneLoadedForPlayer(GameObject lobbyPlayer, GameObject gamePlayer) { // Hide the UI when the scene changes lobbyManagerUI.HideUI(); SetupNetworkVehicle setupNetworkVehicle = gamePlayer.GetComponent <SetupNetworkVehicle>(); SetupVehicleCustomization setupVehicleCustomization = lobbyPlayer.GetComponent <SetupVehicleCustomization>(); // Set the colour from the lobby player to the actual game player setupNetworkVehicle.colours = setupVehicleCustomization.vehicleColour; // Set the part id setupNetworkVehicle.wheelID = setupVehicleCustomization.wheelID; setupNetworkVehicle.spoilerID = setupVehicleCustomization.spoilerID; setupNetworkVehicle.bodyID = setupVehicleCustomization.bodyID; setupNetworkVehicle.characterID = setupVehicleCustomization.characterID; return(base.OnLobbyServerSceneLoadedForPlayer(lobbyPlayer, gamePlayer)); }
// When the player readys up public override void OnClientReady(bool readyState) { base.OnClientReady(readyState); // Check if we have authority over this object (Only allow client of this object to change it, nobody else) if (!hasAuthority) { return; } setupVehicleCustomization = GetComponent <SetupVehicleCustomization>(); // Change the colour on the server if the colour picker was found if (setupVehicleCustomization) { // Request Colour setupVehicleCustomization.CmdRequestColourChange(setupVehicleCustomization.vehicleColour); // Request Parts setupVehicleCustomization.CmdRequestPartChange(setupVehicleCustomization.spoilerID, setupVehicleCustomization.wheelID, setupVehicleCustomization.bodyID, setupVehicleCustomization.characterID); } }