- Home /
PhotonView controlling multiple FPS Controllers
Hello, I've been trying to make a multiplayer test using the standard FPS Controller, and photon. I've completed the examples in Photon, but am still having some trouble figuring this out.
The problem I have is that when I spawn more than 1 client, they control eachother. From what I have understood, I then need to use the following code:
photonView.isMine and check if the current photon view is mine, and then re-enable "MouseLook", and the other controlling components of the FPS Controller.
But unfortunately I'm out of luck, and am having serious troubles getting this to work.
Since I haven't been able to find anyone that has actually done this and published a working sample, I would love if someone would just download my sample project, took a look, and if you can get it to work, explain to me what I did wrong.
This would also let the next person that gets stuck on this figure it out a LOT faster and not waste hour upon hour like I have.
DOWNLOAD LINK
http://rigid-soft.com/NetworkingNew.rar
If you manage to get this running (which should be very trivial to do if you know how to do this. Please explain and if possible leave some comments laying around :).
TL;DR
I need help with getting a FPS Controller working with Photon, I included a project. If you have the knowledge, please download it, help me, and I would be extremely grateful :).
UPDATE
I managed to fix it, and have uploaded a working sample (without photon network, you need to import that yourself from the asset store).
Hello, is it in any way possible to get the project that works, the link doesnt work anymore . It seems im suck at the same place. All seems fine until the second player joins. Thanks.
Hi, I'd like to see what you did, too, since I think I am trying to accomplish the same thing. Can you make this file accessible again, or fix the link? Thanks.
Answer by iwaldrop · Apr 17, 2013 at 01:35 AM
You're definitely on the right track, and Photon is really easy once you get the hang of it. Photon actually comes with some sample scenes that demo what you're trying to do. Check the marco polo scene, or the worker scene.
Essentially, however, you want to make sure that your Player Objects have PhotonViews. Then, in start or awake, you want to do the following:
PhotonView pv = PhotonView.Get(this);
if (pv.isMine)
{
// initialize whatever you need to for the LOCAL player
}
else
{
// destroy or disable things for REMOTE players
}
Thanks for answering! The result I am getting currently is that I do connect properly, and I do enabled the scripts properly. However, now when I move the controls of one of the players, the other one moves ins$$anonymous$$d. And viceversa. $$anonymous$$y current setup is that I run this script on start to connect to a room etc and instantiate a player: http://pastebin.com/9gcHbsCi And then, attached to the player prefab I have this: http://pastebin.com/DaVt$$anonymous$$JBu
One thing I did notice in the other examples is the isControllable variable. And as far as I know, that was added in the tutorial for $$anonymous$$arco Polo, is that a necessity to add for this as well? To avoid this problem?
I figured it out! The problem I was having was partially what you described, but also the fact that I wasn't enabling and disabling the camera for the FPS controller, making the camera send updating data to the other players.
I am going to update my post with a downloadable project containing a working sample for anyone that has trouble in the future :).
Your answer
![](https://koobas.hobune.stream/wayback/20220613100447im_/https://answers.unity.com/themes/thub/images/avi.jpg)