Multiple Camera in your Unity Photon Multiplayer Games ft Eletrax

Поділитися
Вставка
  • Опубліковано 17 вер 2024

КОМЕНТАРІ • 93

  • @protopottygames2648
    @protopottygames2648 5 років тому +20

    This is great..haha
    The "one sided" conversation with a nodding mute GameObject reminds me of something like Mr. Rogers or Sesame Street. 😆

  • @Laranthir
    @Laranthir 3 роки тому +4

    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 !

  • @SxAde
    @SxAde Рік тому +3

    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. 😅

    • @NM-qm5nd
      @NM-qm5nd Рік тому +1

      I love you

    • @SxAde
      @SxAde Рік тому +1

      @@NM-qm5nd I love you too, random user I just met!

    • @infogamer2145
      @infogamer2145  Рік тому

      Thanks for providing some additional helpful information. You Rock!

  • @muellerhans
    @muellerhans 4 роки тому +1

    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.

  • @EverPaintP
    @EverPaintP 3 роки тому +1

    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!

  • @spyroskoustas5284
    @spyroskoustas5284 4 роки тому +6

    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!!!

    • @infogamer2145
      @infogamer2145  4 роки тому +3

      We know the feeling and glad we could help. Thanks for being a subscriber.

  • @overcookedwalrus4482
    @overcookedwalrus4482 9 місяців тому

    Thankyou so much, I have been searching for a while but other sources were unclear, this helps a lot!

  • @ElCurios
    @ElCurios 2 роки тому

    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!!!!!

  • @romanmolchkov862
    @romanmolchkov862 4 роки тому +3

    Dude, you're cool.You solved my main problem.Thank you from Russia.

  • @harshal1341
    @harshal1341 2 роки тому

    Stuck here for whole week, Thanks to you

  • @pressupstudios
    @pressupstudios Рік тому

    THANK YOU SO MUCH I'VE BEEN HAVING THIS ISSUE FOR TOO LONG!

  • @finnf2462
    @finnf2462 2 роки тому

    omg thank u so much i dont know waht i would do without u

  • @MrVGfanatic
    @MrVGfanatic 4 роки тому +1

    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

    • @gabrielpinto5873
      @gabrielpinto5873 4 роки тому

      how did he fix it

    • @MrVGfanatic
      @MrVGfanatic 4 роки тому

      Gabriel Pinto adding the if(!photonView.IsMine){}

    • @MrVGfanatic
      @MrVGfanatic 4 роки тому

      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.

    • @gabrielpinto5873
      @gabrielpinto5873 4 роки тому +1

      @@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);

    • @gabrielpinto5873
      @gabrielpinto5873 4 роки тому

      i just dont know what im doing wrong

  • @FernandoMoreiraR
    @FernandoMoreiraR 3 роки тому +1

    This solved my week long problem, thank you!

  • @brandonellis9060
    @brandonellis9060 3 роки тому

    I could not have found this video at a better time! Great stuff!

  • @BeerfootBandit
    @BeerfootBandit Рік тому

    after hours of trying to fix this I solved it by watching this vid thanks!

  • @sink0peso388
    @sink0peso388 2 роки тому

    I love you man, 3 hours fixing this problem and you save me ¡THANKS!

  • @ignatiusreilly8280
    @ignatiusreilly8280 3 роки тому

    Thanks for showing how to fix this!

  • @ffjeff8005
    @ffjeff8005 4 роки тому +1

    Thank you. This saves my life.

    • @infogamer2145
      @infogamer2145  4 роки тому

      Glad we could help we love saving lives and being the solution to some code headaches.

  • @techinspired5628
    @techinspired5628 3 роки тому +2

    Is Photon PUN 2 good to make a FPS TDM game with 4 members in each team ?

  • @mtgk0
    @mtgk0 Рік тому

    Thanks :)

  • @jofremp5187
    @jofremp5187 2 роки тому

    Thank you so much! This worked for me

  • @Fatih-ox7lp
    @Fatih-ox7lp Рік тому

    Thank you, very helpful

  • @jino_0153
    @jino_0153 2 роки тому

    Thank you so much! Super helpfull!

  • @souviksarkar524
    @souviksarkar524 3 роки тому

    thanks man I am searching for this solution for a long time thanks.

  • @wiicoolnames8268
    @wiicoolnames8268 8 місяців тому

    thanks, it really helped me

  • @user-dx7qw9hd1v
    @user-dx7qw9hd1v 2 роки тому

    Сука це реально так легко робиться!?!?! Дякую чел дуже допоміг!!!!

  • @einJFK
    @einJFK Рік тому

    Thanks man, it's great.

  • @grey-dev
    @grey-dev 3 роки тому

    THANK YOUUU you helped me so much I love this video

  • @kackbiene
    @kackbiene 2 роки тому

    Thank you so much, it works!!!

  • @hackernik6572
    @hackernik6572 2 роки тому

    Thank you so much!

  • @pariiyiy3147
    @pariiyiy3147 Рік тому +1

    lifesaver

    • @infogamer2145
      @infogamer2145  Рік тому

      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.

  • @guadog
    @guadog Рік тому

    THANK YOU SO MUCH!!!

  • @apirss_
    @apirss_ Рік тому +1

    Giga CHAD thx

    • @infogamer2145
      @infogamer2145  Рік тому

      Well thanks and glad we could help. We hope you will go through some of our other tutorials.

  • @BlackLightTM
    @BlackLightTM 4 роки тому +1

    Thanks!

  • @jannikgaming9521
    @jannikgaming9521 3 роки тому

    Thank you so much this helped a lot!

  • @xVecna
    @xVecna 4 роки тому

    thanks man you helped me fix a bug. you look like alexander supertramp

  • @ninnox582
    @ninnox582 2 роки тому

    Thank you so much

  • @triple3204
    @triple3204 Рік тому

    Bro I’m not even at my computer lol. It seems like it’ll work though so thank you!

  • @DevRamo
    @DevRamo 3 роки тому

    why is this working wt? :D Thank you so much, I could never found this solve anywhere

  • @shaaaanid
    @shaaaanid 3 роки тому

    u came hear as an angel

  • @blaze4074
    @blaze4074 2 роки тому

    this video helped me too :D

  • @Redstonemax
    @Redstonemax 5 років тому

    Thank you, very helpful :D

  • @mikisali4239
    @mikisali4239 2 роки тому

    thanks a lot

  • @yesquen9856
    @yesquen9856 2 роки тому

    Muchas gracias, me sirvió la información

  • @Jimaniki
    @Jimaniki 5 років тому

    Thank you.

  • @MrZackyouells
    @MrZackyouells 5 років тому +4

    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..

  • @farrukhzaib8305
    @farrukhzaib8305 4 роки тому

    Thankyou So Much , It worked for me too

  • @AboFroos
    @AboFroos 3 роки тому

    ❤❤ thanks

  • @shazil3307
    @shazil3307 3 роки тому

    you're amazing

  • @x6Blade9x
    @x6Blade9x 5 років тому +1

    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

  • @gabrielpinto5873
    @gabrielpinto5873 4 роки тому +2

    i didnt really understand what you did, i have the same problem and don't know how to fix it, can you explain please!!!

  • @PolkacityOfficial
    @PolkacityOfficial 3 роки тому

    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?

  • @believer5375
    @believer5375 4 роки тому

    thank's a lot of))) that was exactly the problem I had

  • @sahpdude
    @sahpdude Рік тому

    The nod LOL

  • @dejungelinafrika
    @dejungelinafrika Рік тому

    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

  • @victorzhang6859
    @victorzhang6859 3 роки тому +1

    i would suggest editing out the first part; it confused me

  • @bilbostabbins1882
    @bilbostabbins1882 2 роки тому

    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

  • @yarriksauker993
    @yarriksauker993 2 роки тому

    THAAAAAAAAANK YOOOOOOOUU

  • @mrcactus5680
    @mrcactus5680 2 роки тому

    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

  • @sebrlrl2043
    @sebrlrl2043 2 роки тому

    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

  • @PankajSir_azoneclasses
    @PankajSir_azoneclasses Рік тому

    i am happy

  • @vectorinteractiveoffical
    @vectorinteractiveoffical 4 роки тому

    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
      @gabrielpinto5873 4 роки тому

      and how would i do that? sorry im just new to unity

    • @vectorinteractiveoffical
      @vectorinteractiveoffical 4 роки тому +1

      @@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

    • @FazOzturk
      @FazOzturk 2 роки тому

      Dude can you say whic episode and time ?

  • @raymond-exe
    @raymond-exe 4 роки тому

    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)

  • @dannyjace185
    @dannyjace185 3 роки тому

    you kinda look like a young willem dafoe my man

  • @coldapollo8731
    @coldapollo8731 4 роки тому

    When i disable the camera the guns goes away for the other player idk what to do

  • @ReazerDev
    @ReazerDev 4 роки тому

    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)

    • @recxgems
      @recxgems 4 роки тому

      It should be the exact same solution to your problem as the problem solved in this video.

  • @paulkevin5820
    @paulkevin5820 4 роки тому

    I've solved this problem by simply deactivating the camera if photon.ismine is not equal to true .

  • @juanzamora6405
    @juanzamora6405 5 років тому

    Sniper shot whith raycast and a presition very exatly, please !!!!

  • @sillyninja65
    @sillyninja65 Рік тому

    nope.

  • @theskeletonappearsinthisco5896

    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

  • @richardwitt6243
    @richardwitt6243 4 роки тому

    Thank you so much :).

  • @juanzamora6405
    @juanzamora6405 5 років тому

    Sniper shot whith raycast and a presition very exatly, please !!!!