Search Unity

Question Disabling scripts and objects that aren't your own

Discussion in 'Multiplayer' started by ShadowFlame45, Nov 6, 2022.

  1. ShadowFlame45

    ShadowFlame45

    Joined:
    Nov 6, 2021
    Posts:
    10
    I'm making a multiplayer game using Photon Fusion, and I am at the point where players can host and join, but I don't know how to detect which scripts or objects to disable.

    I've tried setting and getting player objects and enabling your scripts if your ID is found, but getting the player object didn't return anything. I've also tried getting the network ID and finding the gameobject by the network object component, but I don't know how to access the ID.

    Are any of my attempted solutions the correct idea, but I'm just doing something wrong, and if not, how would I disable them?
     
  2. ShadowFlame45

    ShadowFlame45

    Joined:
    Nov 6, 2021
    Posts:
    10
    I have managed to solve this, i just watched a tutorial.

    The solution was to use the equivalent of PhotonView.isMine in Fusion, which was split into Object.hasStateAuthority and Object.hasInputAuthority. I forgot what the class inherited from, but after adding it, you could access the Object class.

    (this was the tutorial.)
     
    tobiass likes this.