I managed to learn and how to set up multiplayer to my project in less than 2-3 days thanks to your videos. The only issue i had was having multiple cameras & audio listeners active. You saved me again, much appreciated !
This was super useful, thanks! Just a quick note for anyone else: if you're using Cinemachine you do also have to delete the VirtualCamera in the player prefab, I struggled a couple of hours trying to realize what was wrong with my code and settings after watching this video. 😅
I searched for "PUN2 fps camera ismine" and found this video. Had ismine in my update script and various other places, but not in start for the camera. It's rare that the first result actually helps. Thanks for this video.
Thank you very much! I've started to do this project of mine couple of months ago and I sorted this problem in a very-very similar way. In the last few weeks moved some stuff around in my character and the camera suddenly started to behave like here. What made it even worse, there was a big merge on the project and I thought that must have caused it. Spent about 3 hours before I bumped into your video, then I realized that I moved some stuff around and never checked it if it still works with multiplayer lol. Million thanks again, keep up the good work, there are not too many good Photon tutorials out there!
Thank you so much. The amount of time that I invested in this issue is enormous and I was finally able to fix this by watching your video!!! Amazing!!!
I've been struggeling for about almost 5 hours and FINALLY after being TOTALLY STRESSED OUT, I found this!!! Thank you soooo much you dont know how happy that makes me!!!!!
Thank you! I went through most of your more recent tutorials and spent the past couple hours trying to figure this one out on my own. Such a simple fix. :D
More specifically: The player game object needs to have a Photon View component. Then in one of the scripts that is on that object, there are two variables that need to be added: private PhotonView myPhotonView; private GameObject myCamera; Then in the Start() method, I added: myPhotonView = GetComponent(); if(this.gameObject.transform.name == "Game Object 1"){ myCamera = GameObject.Find("Camera 1"); } else if(this.gameObject.transform.name == "Game Object 2"){ myCamera = GameObject.Find("Camera 2"); } if(!myPhotonView.IsMine){ //Or I could write if(myPhotonView.IsMine == false){ myCamera.SetActive(false); } I also wrapped the methods I have in my Update() method in this: if(myPhotonView.IsMine){ } //Or I could write if(myPhotonView.IsMine == true){ } Hope this helps! Note: In my project, i'm instantiating two different game objects, which is why I have the if statements seeing if the game object is "Game Object 1" or "Game Object 2". Each Game Object here is using the same script, but they each have a camera with a different name.
@@MrVGfanatic DUDE You just helped me A TON!!! i have one more question, are you using "MonoBehaviorPunCallbacks"? because when i use it it gives me errors in myCamera = GameObject.Find("Camera 1"); myCamera = GameObject.Find("Camera 2"); and also in myCamera.SetActive(false);
cool, i like to check these videos where he adresses errors,literally all of them end up happening to me at some point.. or many points simultaneously hauha..
I have problem with third person cam. If I have one player connected the camera follows, when the second joins the camera just disconnect from both players. It sits at were players spawn and don't move. I can move the players just fine in their own windows
At 7:19 the other player's look direction isn't completely replicated, do you know a possible fix as to why this happens? even in my game my character can rotate easily on the y axis but the camera doesn't til up or down to show where they are looking after applying your fix
Hey guys you could alternately make a player setup script which will disable components or game objects if you do not own the player. Brackeys did this in his FPS multiplayer tutorial series and I just converted it to photon and it works the same
@@gabrielpinto5873 here sorry for the late reply public behavior[] scriptsToDisable; in Start or Awake method(i use start) if(!PhotonView.IsMine) { DisableComponents(); } else { DoMyPlayerStuff(); } in disablecomponents() for scipts; for (int i = 0; i < scriptsToDisable.Length; i++) { scriptsToDisable[i].enabled = false; } this will go through all the scripts you have assigned in the inspector and disable them; you can do this with gameobjects to just change public behavior[] scriptsToDisable; to, public GameObject[] scriptsToDisable; and scriptsToDisable[i].enabled = false; to GameObjectsToDisable[i].setactive(false); this way you can disable your camera behavior or the whole camera gameobject. You can also put in scripts that you don't want other players to control like your movement controller etc. public GameObject[] GOToDisable; public behavior[] scriptsToDisable; PhotonView PV; void Start() { if(!PV.IsMine) { DisableComponents(); } else { DoMyPlayerStuff(); } } public void DisableComponents() { //Scripts for (int i = 0; i < scriptsToDisable.Length; i++) { scriptsToDisable[i].enabled = false; } //GameObjects for (int i = 0; i < GOToDisable.Length; i++) { GOToDisable[i].SetActive(false); } } Hoped this helped heres the original video which is in silly unet language (easy to understand and convert anyway) ua-cam.com/video/-m28axeuRNs/v-deo.html
Hi. I have a similar problem. But instead of only the latest camera being used, the players switch cameras. Can you send me an invite code to your Discord? (The one in the description doesn't work)
this didnt work for me for some resaon i put if (myPhotonView.IsMine == false) { //camera ///Destroy(cam); cam.enabled = false; } and it still didnt work edit: it just disalbes everyone elses camera so the only camera was the original player and everyone saw through that camera edit; it i made it work after i made a new player and a new script, it tunrs out i just had to update my game so the new code was there
This is great..haha
The "one sided" conversation with a nodding mute GameObject reminds me of something like Mr. Rogers or Sesame Street. 😆
I managed to learn and how to set up multiplayer to my project in less than 2-3 days thanks to your videos. The only issue i had was having multiple cameras & audio listeners active. You saved me again, much appreciated !
This was super useful, thanks!
Just a quick note for anyone else: if you're using Cinemachine you do also have to delete the VirtualCamera in the player prefab, I struggled a couple of hours trying to realize what was wrong with my code and settings after watching this video. 😅
I love you
@@NM-qm5nd I love you too, random user I just met!
Thanks for providing some additional helpful information. You Rock!
I searched for "PUN2 fps camera ismine" and found this video. Had ismine in my update script and various other places, but not in start for the camera.
It's rare that the first result actually helps. Thanks for this video.
Thank you very much! I've started to do this project of mine couple of months ago and I sorted this problem in a very-very similar way. In the last few weeks moved some stuff around in my character and the camera suddenly started to behave like here. What made it even worse, there was a big merge on the project and I thought that must have caused it. Spent about 3 hours before I bumped into your video, then I realized that I moved some stuff around and never checked it if it still works with multiplayer lol.
Million thanks again, keep up the good work, there are not too many good Photon tutorials out there!
Thank you so much. The amount of time that I invested in this issue is enormous and I was finally able to fix this by watching your video!!! Amazing!!!
We know the feeling and glad we could help. Thanks for being a subscriber.
Thankyou so much, I have been searching for a while but other sources were unclear, this helps a lot!
I've been struggeling for about almost 5 hours and FINALLY after being TOTALLY STRESSED OUT, I found this!!! Thank you soooo much you dont know how happy that makes me!!!!!
Dude, you're cool.You solved my main problem.Thank you from Russia.
Stuck here for whole week, Thanks to you
THANK YOU SO MUCH I'VE BEEN HAVING THIS ISSUE FOR TOO LONG!
omg thank u so much i dont know waht i would do without u
Thank you! I went through most of your more recent tutorials and spent the past couple hours trying to figure this one out on my own. Such a simple fix. :D
how did he fix it
Gabriel Pinto adding the if(!photonView.IsMine){}
More specifically:
The player game object needs to have a Photon View component.
Then in one of the scripts that is on that object, there are two variables that need to be added:
private PhotonView myPhotonView;
private GameObject myCamera;
Then in the Start() method, I added:
myPhotonView = GetComponent();
if(this.gameObject.transform.name == "Game Object 1"){
myCamera = GameObject.Find("Camera 1");
} else
if(this.gameObject.transform.name == "Game Object 2"){
myCamera = GameObject.Find("Camera 2");
}
if(!myPhotonView.IsMine){ //Or I could write if(myPhotonView.IsMine == false){
myCamera.SetActive(false);
}
I also wrapped the methods I have in my Update() method in this:
if(myPhotonView.IsMine){ } //Or I could write if(myPhotonView.IsMine == true){ }
Hope this helps!
Note: In my project, i'm instantiating two different game objects, which is why I have the if statements seeing if the game object is "Game Object 1" or "Game Object 2". Each Game Object here is using the same script, but they each have a camera with a different name.
@@MrVGfanatic DUDE You just helped me A TON!!! i have one more question, are you using "MonoBehaviorPunCallbacks"? because when i use it it gives me errors in
myCamera = GameObject.Find("Camera 1");
myCamera = GameObject.Find("Camera 2");
and also in
myCamera.SetActive(false);
i just dont know what im doing wrong
This solved my week long problem, thank you!
I could not have found this video at a better time! Great stuff!
after hours of trying to fix this I solved it by watching this vid thanks!
I love you man, 3 hours fixing this problem and you save me ¡THANKS!
Thanks for showing how to fix this!
Thank you. This saves my life.
Glad we could help we love saving lives and being the solution to some code headaches.
Is Photon PUN 2 good to make a FPS TDM game with 4 members in each team ?
Thanks :)
Thank you so much! This worked for me
Thank you, very helpful
Thank you so much! Super helpfull!
thanks man I am searching for this solution for a long time thanks.
thanks, it really helped me
Сука це реально так легко робиться!?!?! Дякую чел дуже допоміг!!!!
Thanks man, it's great.
THANK YOUUU you helped me so much I love this video
Thank you so much, it works!!!
Thank you so much!
lifesaver
Glad this was able to help. We hope you check out some of our other tutorials also! Thanks for letting us know that we were helpful.
THANK YOU SO MUCH!!!
Giga CHAD thx
Well thanks and glad we could help. We hope you will go through some of our other tutorials.
Thanks!
Thank you so much this helped a lot!
thanks man you helped me fix a bug. you look like alexander supertramp
Thank you so much
Bro I’m not even at my computer lol. It seems like it’ll work though so thank you!
why is this working wt? :D Thank you so much, I could never found this solve anywhere
u came hear as an angel
this video helped me too :D
Thank you, very helpful :D
thanks a lot
Muchas gracias, me sirvió la información
Thank you.
cool, i like to check these videos where he adresses errors,literally all of them end up happening to me at some point.. or many points simultaneously hauha..
Thankyou So Much , It worked for me too
You're welcome! Glad it helped.
❤❤ thanks
you're amazing
I have problem with third person cam. If I have one player connected the camera follows, when the second joins the camera just disconnect from both players. It sits at were players spawn and don't move. I can move the players just fine in their own windows
i didnt really understand what you did, i have the same problem and don't know how to fix it, can you explain please!!!
I have this same problem, But cant get the camera to serialize for nothing in the world. Any change you can help and do another video?
thank's a lot of))) that was exactly the problem I had
The nod LOL
Do you know how to fix the error object reference not set to an instance of an object! I can’t really find a working answer
i would suggest editing out the first part; it confused me
At 7:19 the other player's look direction isn't completely replicated, do you know a possible fix as to why this happens?
even in my game my character can rotate easily on the y axis but the camera doesn't til up or down to show where they are looking after applying your fix
THAAAAAAAAANK YOOOOOOOUU
i know i am late to this video but i cant really follow how to repair the error, i dont have the kind of controller he has so i cant really do nothing
I'm having some similar issues with photon for my game but i was unable to solve it and I'm unable to join the discord
i am happy
Hey guys you could alternately make a player setup script which will disable components or game objects if you do not own the player. Brackeys did this in his FPS multiplayer tutorial series and I just converted it to photon and it works the same
and how would i do that? sorry im just new to unity
@@gabrielpinto5873 here sorry for the late reply
public behavior[] scriptsToDisable;
in Start or Awake method(i use start)
if(!PhotonView.IsMine)
{
DisableComponents();
}
else
{
DoMyPlayerStuff();
}
in disablecomponents()
for scipts;
for (int i = 0; i < scriptsToDisable.Length; i++)
{
scriptsToDisable[i].enabled = false;
}
this will go through all the scripts you have assigned in the inspector and disable them;
you can do this with gameobjects to just change public behavior[] scriptsToDisable; to, public GameObject[] scriptsToDisable;
and scriptsToDisable[i].enabled = false; to GameObjectsToDisable[i].setactive(false);
this way you can disable your camera behavior or the whole camera gameobject. You can also put in scripts that you don't want other players to control like your movement controller etc.
public GameObject[] GOToDisable;
public behavior[] scriptsToDisable;
PhotonView PV;
void Start()
{
if(!PV.IsMine)
{
DisableComponents();
}
else
{
DoMyPlayerStuff();
}
}
public void DisableComponents()
{
//Scripts
for (int i = 0; i < scriptsToDisable.Length; i++)
{
scriptsToDisable[i].enabled = false;
}
//GameObjects
for (int i = 0; i < GOToDisable.Length; i++)
{
GOToDisable[i].SetActive(false);
}
}
Hoped this helped
heres the original video which is in silly unet language (easy to understand and convert anyway)
ua-cam.com/video/-m28axeuRNs/v-deo.html
Dude can you say whic episode and time ?
I noticed he's using PUN, is there a way to do this using Photon Bolt instead? (since I don't believe Bolt has the PhotonView class)
you kinda look like a young willem dafoe my man
When i disable the camera the guns goes away for the other player idk what to do
Hi. I have a similar problem. But instead of only the latest camera being used, the players switch cameras. Can you send me an invite code to your Discord? (The one in the description doesn't work)
It should be the exact same solution to your problem as the problem solved in this video.
I've solved this problem by simply deactivating the camera if photon.ismine is not equal to true .
Sniper shot whith raycast and a presition very exatly, please !!!!
nope.
this didnt work for me for some resaon
i put
if (myPhotonView.IsMine == false)
{
//camera
///Destroy(cam);
cam.enabled = false;
}
and it still didnt work
edit: it just disalbes everyone elses camera so the only camera was the original player and everyone saw through that camera
edit; it i made it work after i made a new player and a new script, it tunrs out i just had to update my game so the new code was there
Thank you so much :).
Sniper shot whith raycast and a presition very exatly, please !!!!