OnPhotonPlayerConnected is not getting called

Options
Hi,

To initialize players I thought to use OnPhotonPlayerConnected call back but no matter where I put it, it won't get called back.

I've put it in my PlayerController that is derived from Photon.PunBehaviour, didn't get called. Put it on my match maker code that handles player instantiation via PhotonNetwork.Instantiate, didn't get called neither.

What do you think I'm missing?

Comments

  • vadim
    Options
    You only need "void OnPhotonPlayerConnected(PhotonPlayer player) " method implemented on one of MonoBehaviour scripts in scene. Take a look at DemoWorker and MarcoPolo-Tutorial demos. They use OnPhotonPlayerConnected( handlers.
  • Aidin
    Options
    Problem is, its not getting callend no matter where I put it.
  • vadim
    Options
    Does it work in demos I mention above?
    The only way to disable messages I can imagine is use of PhotonNetwork.SendMonoMessageTargets, PhotonNetwork.SendMonoMessageTargetType or PhotonNetwork.CacheSendMonoMessageTargets
  • Aidin
    Options
    Cant test the demos right now. Also not using any of those three methods.
  • Aidin
    Options
    I've tested and none of Photon callbacks in "WorkerInGame.cs" are getting called in Woder Demo. Neither in my own game.

    Also a side question, do these call backs need to get viewed by a photon view or are getting called by a mechanism like reflection that won't need them to be registered anywhere?
  • Aidin
    Options
    I've tested and none of Photon callbacks in "WorkerInGame.cs" are getting called in Woder Demo. Neither in my own game.

    Also a side question, do these call backs need to get viewed by a photon view or are getting called by a mechanism like reflection that won't need them to be registered anywhere?
  • Aidin
    Options
    I've updated to 1.65 and tried the Worker demo again with same results as previously mentioned. I get call backs to "OnCreatedRoom", "OnLeftRoom" and "OnDisconnectedFromPhoton" but not the OnPhotonPlayerConnected.
  • vadim
    Options
    It works for me in DemoWorker.
    OnCreateRoom triggered and logged when "Create Room" pressed:
    "OnCreatedRoom
    UnityEngine.Debug:Log(Object)"
    When 2nd client joins the room with "Join Random" , 1st client logs:
    "OnPhotonPlayerConnected: 'Guest4058'
    UnityEngine.Debug:Log(Object)"
    I use PUN 1.65
  • Aidin
    Options
    I'm using same PUN but can't get it to work. How can I investigate it more?
  • vadim
    Options
    Please make a little project which reproduces the issue and share it with us.