I am creating a simple red-vs-blue team based FPS. I was able to get multiplayer working with Photon PUN, and my bf and I were able to join a room together. However there is a major problem:
Our models both show as red. There is a team-switching mechanic where you can hold a button to change teams. Teams are also randomly assigned on entry. Here’s my problem: the player model does not update colors on the other person’s monitor. If I’m red, and I switch to blue, my character will still show as red on my boyfriend’s PC. The same applies if I randomly spawn as blue on entry.
Fixes I’ve tried: spawning entirely different models on entry; making teams player choice-only; experimenting with RPC calls; and following just about every tutorial I could find on the matter on YouTube and Udemy. I’ve been stuck on this for over a month.
Does anyone have any clue what to do?? Does anyone have a link to any simplistic red vs blue games with an open source I can tweak? Does anyone have the same issue? In one instance, I tried to follow a YouTube tutorial only for the video to end with the creator running into the EXACT SAME PROBLEM I had.
Are you able to move your player and those moves show up on the other screen? If so, whatever is communicating movements can also communicate “team change” messages.
What I meant is, if you have functional movement updates, find out HOW those work. You’ll have to do the work of making a similar message type that handles team membership updates.
I don’t know what else to say. I tried using PunRPC today to no avail. Another day of failed solutions, still have not figured out how to correctly update the team color.
Use Photon Custom Properties. Look up how to set them, but you should be careful that only one client is setting them for a given player. In your start method, you’re randomly choosing a team. You should only randomly choose a team if photonView.isMine is true, otherwise you should let the remote Photon tell your client what team they’re on. Also, if the player changes teams, the same rule applies, only be sure you’re using the correct way to set the custom property for team, and handling the custom property update correctly.