[Help] I am lost and terrified on instantiation

Options
Hi there! I might have exagerated on my title, but you get the idea. Basically, i'm working on a 3D 2 players board game, and photon seems like the perfect thing to me.
Players can instantiate their on pieces, with several buttons.
Players are instantiated, too. I mean, at some point, of course. And what i wanted to do is instantiate one on one side, and the other on the other side. And man, should this be EZ-PZ. And yet, there are some things i don't get.
int j = 0; //That's player one
        if (!PV.AmOwner)
        {
            //So that's player "two" 
            j = 1;
        }
        GameObject player = PhotonNetwork.Instantiate(Path.Combine("PhotonPrefab", "PlayerController"),InstTransform[j].transform.position, InstTransform[j].transform.rotation);
        GameManager.Instance.players.Add(player);
//I believe all my variables have explicite names, but ask me if you're confused about something.
And this... Does not work at all! Both of my POVs are instantiated at the same place. Yet my two transforms are correctly places (the ones in InstTransform[]), adn i just... Don't know, man.

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    edited March 2021
    Options
    Hi @DonTomas,

    Thank you for choosing Photon!

    What PUN version do you use?

    Please do not use AmOwner and use IsMine for the time being, AmOwner could be unused and never set internally! Thank you for your understanding!
  • Tobias
    Options
    PUN 2.28.3 will be in the store any minute and has a fix for AmOwner.
  • DonTomas
    DonTomas
    edited March 2021
    Options
    Wow! Well thanks there! But i thought this "amOwner" was to detecting who is the master of the room, but then what is it?
    All i need is a way to say "that is player one, that is player 2" on both clients. The way i'm doing this right now (haven't tested yet) is to take the highest PV.CreatorActorNr and assign it to player 1.
    How do i easily udpate my project to the newest photon version? Without undoing all my project lol

    Update: ok i am even more terrified now
    Basically, i managed to instantiate my players with their player 1/2 number, and yet, i get the same POV on both clients (editor and built). I see they are connected, of course. but it seems like the built one has 2 cameras (and chose the wrong one, ofc). So basically i think i have one player instanciated in the editor and two in the build. Why and how? I don't know, please help me, i'm scared
  • Tobias
    Options
    I think you skipped some early steps.
    Do the Pun Basics Tutorial and you will learn how to identify the local character and to handle the camera, etc.:
    https://doc.photonengine.com/en-us/pun/current/demos-and-tutorials/pun-basics-tutorial/intro
  • DonTomas
    DonTomas
    edited March 2021
    Options
    Thanks a bunch! Oh, wait... So basically, i should MAYBE (lol) Implement IpunObservable into my playerController and/or my playerManagers? That could be a first step?
    I'm getting into all that, especially the SendNext and ReceiveNext methods... Are those basically pushes and pulls for data? I could... Kind of use that! I'm really looking forward to those methods (if they're really what i think they are), but i don't really know how it's effectively working... Is there a video or a tutorial explaining their behavior deeply somewhere?
  • Tobias
    Options
    We did not explain PUN in deep detail, no. The docs should provide what's needed and then some and there are several tutorials about PUN on YT, etc.
    I couldn't watch all, so it's hard to give a recommendation...