Search Unity

Third Party [PHOTON] Destroy scene object

Discussion in 'Multiplayer' started by shuskry, Apr 3, 2017.

  1. shuskry

    shuskry

    Joined:
    Oct 10, 2015
    Posts:
    462
    Hi everybody ! :)

    First, i use Photon network in my project ! :)

    I have some trouble with Scene object,
    -i use a Spawn system to create Scene object (monster)
    -I know that scene object can be destroy exclusively by the master client cause the ownsership of a scene object is the master

    so , how can i do if a other client killed a monster ? is it possible to transfer the ownership of a sceneobject to a other client ?
    I read the basic tutorial of PUN to transfer ownership but i don't really understand how it's work and how to do that ...:/

    Maybe , my spawn system is not the good way ?

    Thx for helping !
    Have a good day !
     
  2. UmarFarooq007

    UmarFarooq007

    Joined:
    May 10, 2019
    Posts:
    1
    So, no one replied to you in a long a time:)
     
  3. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,735
    And your reply was oh so helpful, and it being your first post, I'd ban you if I were a mod!

    As you've seen fit to dredge this up, in case anyone else is struggling with the same issue and reads this, ownership can be transferred using RequestOwnership(), or you could send an RPC to the MasterClient instructing it to delete it for you.

    I think the first option is preferred, due to the fact that the MasterClient can disconnect before receiving the RPC in which case it would be lost.
     
    Joe-Censored likes this.
  4. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    That happens when no one who sees the thread knows the answer in the short time before the question drops lower on the page. Please don't necro the other thousands of similar threads.
     
    shuskry likes this.