Why does my photonView.IsMine get set to false in the editor?

I am trying to inspect some objects in the scene while the game is running in the editor and my player photonView.IsMine gets set to false instantly. I can no longer control it and have to restart. This makes it impossible to inspect anything in the scene hierarchy while the game is running.

Answers

  • This is happening to me as well. As soon as I select the GameObject that has the PhotonView component attached, isMine gets set to false.
  • Which Editor are you using and which version of PUN 2?
    Does it happen in our demos as well? In the basics tutorial?? Can we reproduce this with the demos?

    We planned to streamline the code of IsMine (and related), so we got a branch with changes. This is PUN 2.27 with those changes. Maybe you could give it a go and report back any issues? If there are none (our testing didn't expose any), we could update PUN accordingly.

    https://www.dropbox.com/s/2xmswxgxy5daabr/PunExport-2-27-OwnershipBranch.unitypackage?dl=1
  • Tobias wrote: »
    Which Editor are you using and which version of PUN 2?

    I have been using multiple editors in the 2019 LTS branch. Currently using 2019.4.18f1.
    I have not had time to test the tutorials or demos or anything like that as I am working with the company project under a strict time schedule. But it should be pretty easy for you guys to reproduce this. Just click on any photonView gameObject in the scene hierarchy when the game is running and observe how isMine is set to false without any reason.
  • Tobias wrote: »
    Maybe you could give it a go and report back any issues?

    I found an issue in our project.
    In PUN version 2.26.1, when the master client instantiates a Room Object, the Room Object PhotonView was configured in a way that IsMine would be set to true for the Master Client, and the Controller would be assigned to the master client. However, with this update 2.27 that I downloaded and Implemented in the project, the IsMine bool is set to false, and controller is set to null.

    I don't know if this is by design, or if this is a bug.

  • Sorry for the late follow-up.

    Thanks for the input. I will check.
    By design, the Master Client is the controller for room/scene objects, unless ownership (control) is passed over to someone else.
  • I found another issue with Room Objects,
    Tobias wrote: »
    By design, the Master Client is the controller for room/scene objects, unless ownership (control) is passed over to someone else.

    If that is the case then it is currently bugged in the version you sent me 2.27. Could you update me when this is fixed? Currently I have implemented a work-around by transferring ownership to the master client to be able to use OnPhotonSerialize, as OnPhotonSerialize never runs on Room Objects for some reason (probably because IsMine is set to false).

    However, I do not believe that OnPhotonSerialize should be un-useable for roomobjects without an owner. If a player affects a room Objects position, this should update on all other clients regardless if it has no owner or controller.
  • Is this feedback for the PUN version from the Asset Store or for the variant I sent you above?
    I need to make sure it's one or the other or both...
  • FadiB
    FadiB
    edited February 2021
    Tobias wrote: »
    Is this feedback for the PUN version from the Asset Store or for the variant I sent you above?
    I need to make sure it's one or the other or both...

    This feedback was specifically for the version you sent me, 2.27 with the dropbox link. I am not sure if this happens on 2.26.1 as I have no way of testing this right now. But I assume the same happens in 2.26.1
  • I see.
    Have to try to repro this. Thanks for the input.
    One more question: Which Editor version do you use?
  • Tobias wrote: »
    I see.
    Have to try to repro this. Thanks for the input.
    One more question: Which Editor version do you use?

    Currently I am using the latest 2019 LTS version 2019.4.19f1 LTS
  • Tobias
    Tobias admin
    edited February 2021
    It took a while but I created an updated package. Same link:
    https://www.dropbox.com/s/2xmswxgxy5daabr/PunExport-2-27-OwnershipBranch.unitypackage?dl=1

    For scene objects (loaded with the scene) and room objects (instantiated with InstantiateRoomObject()) will both get a controller assigned properly. Owner and creator are 0 / blank for those objects. Control for those is the Master Client unless you transfer it.

    Let me know how this one does, if you have the time. Thanks!
    Edit: There will be a few debug logs in this version. They are not in the final version (and are harmless).
  • @FadiB , would you mind having another look?
  • Tobias wrote: »
    @FadiB , would you mind having another look?

    I checked it out briefly and it seemed to work correctly at least on my end. I have not been able to test it further as I've been working on another project using Photon Bolt. But the functions I was using and isMine was all working correctly and the master client were in control of roomviews and synced them across the network without any issues
  • Thanks.