playMaker

Author Topic: Photon Failed To Network Remove Gameobject  (Read 250 times)

KillerCreeper

  • Playmaker Newbie
  • *
  • Posts: 38
    • View Profile
Photon Failed To Network Remove Gameobject
« on: June 10, 2019, 10:47:21 AM »
I have an item pickup script that, when hovering over on an item with your cursor at a certain distance and press F, it will delete the item and add it into the inventory. I keep getting this error when testing it with the second client that joined. Is there any solution to this?


Code: [Select]
Failed to 'network-remove' GameObject. Client is neither owner nor masterClient taking over for owner who left: View (0)1 on M16 Carbine (scene)
UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:LogError(Object)
NetworkingPeer:RemoveInstantiatedGO(GameObject, Boolean) (at D:\Unity\Survival Inc\Assets\Photon Unity Networking\Plugins\PhotonNetwork\NetworkingPeer.cs:3463)
PhotonNetwork:Destroy(GameObject) (at D:\Unity\Survival Inc\Assets\Photon Unity Networking\Plugins\PhotonNetwork\PhotonNetwork.cs:2746)
HutongGames.PlayMaker.Actions.PhotonNetworkDestroy:doDestroy() (at D:\Unity\Survival Inc\Assets\PlayMaker PUN\Actions\PhotonNetworkDestroy.cs:37)
HutongGames.PlayMaker.Actions.PhotonNetworkDestroy:OnEnter() (at D:\Unity\Survival Inc\Assets\PlayMaker PUN\Actions\PhotonNetworkDestroy.cs:24)
HutongGames.PlayMaker.FsmState:ActivateActions(Int32) (at C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\FsmState.cs:205)
HutongGames.PlayMaker.FsmState:OnEnter() (at C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\FsmState.cs:175)
HutongGames.PlayMaker.Fsm:EnterState(FsmState) (at C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\Fsm.cs:2771)
HutongGames.PlayMaker.Fsm:SwitchState(FsmState) (at C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\Fsm.cs:2718)
HutongGames.PlayMaker.Fsm:UpdateStateChanges() (at C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\Fsm.cs:2643)
HutongGames.PlayMaker.Fsm:DoTransition(FsmTransition, Boolean) (at C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\Fsm.cs:2685)
HutongGames.PlayMaker.Fsm:ProcessEvent(FsmEvent, FsmEventData) (at C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\Fsm.cs:2253)
HutongGames.PlayMaker.Fsm:SendEventToFsmOnGameObject(GameObject, String, FsmEvent) (at C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\Fsm.cs:2622)
HutongGames.PlayMaker.Fsm:Event(FsmEventTarget, FsmEvent) (at C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\Fsm.cs:2389)
HutongGames.PlayMaker.Actions.SendEvent:OnEnter() (at D:\Unity\Survival Inc\Assets\PlayMaker\Actions\StateMachine\SendEvent.cs:42)
HutongGames.PlayMaker.FsmState:ActivateActions(Int32) (at C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\FsmState.cs:205)
HutongGames.PlayMaker.FsmState:OnEnter() (at C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\FsmState.cs:175)
HutongGames.PlayMaker.Fsm:EnterState(FsmState) (at C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\Fsm.cs:2771)
HutongGames.PlayMaker.Fsm:SwitchState(FsmState) (at C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\Fsm.cs:2718)
HutongGames.PlayMaker.Fsm:UpdateStateChanges() (at C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\Fsm.cs:2643)
HutongGames.PlayMaker.Fsm:UpdateState(FsmState) (at C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\Fsm.cs:2787)
HutongGames.PlayMaker.Fsm:Update() (at C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\Classes\Fsm.cs:1995)
PlayMakerFSM:Update() (at C:\Projects\Playmaker_1.9.0\Projects\Playmaker.source.unity\Assets\PlayMaker\PlayMakerFSM.cs:586)
« Last Edit: June 11, 2019, 06:29:01 AM by djaydino »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4192
    • View Profile
    • jinxtergames
Re: Photon Failed To Network Remove Gameobject
« Reply #1 on: June 11, 2019, 06:34:14 AM »
Hi.
I have edited you post, that yellow hurts to the eye and makes it unreadable :)

You can use the # to place something like this :)

I have no Experience with Photon, but i think you will need to give some more information on how you are deleting and what are you sending thru Photon.

The more information, the easier it is for others to find a solution :)

KillerCreeper

  • Playmaker Newbie
  • *
  • Posts: 38
    • View Profile
Re: Photon Failed To Network Remove Gameobject
« Reply #2 on: June 11, 2019, 10:10:58 AM »
Hi.
I have edited you post, that yellow hurts to the eye and makes it unreadable :)

You can use the # to place something like this :)

I have no Experience with Photon, but i think you will need to give some more information on how you are deleting and what are you sending thru Photon.

The more information, the easier it is for others to find a solution :)

Sorry about that, I have a dark mode addon for chrome, so the yellow doesn't look bad for me.

But each player has an "Inventory Manager." It's a simple empty game object just to group up the inventory. I'm using a raycast on the main camera. Whenever the player picks up an object, the item that was picked up gets sent into the inventory manager and it sends an event to the inventory manager called "Add item" which gets all of the variables attached to the item, finds an empty array, and stores the variables in the array. The problem is destroying the game object, which I am using "Photon Network Destroy" for that. As I said before, it works for the first client that joined but not the second.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14126
  • Official Playmaker Support
    • View Profile
Re: Photon Failed To Network Remove Gameobject
« Reply #3 on: June 12, 2019, 04:21:20 AM »
Hi,

 the error says: Client is neither owner nor masterClient taking over for owner who left:

 in order to remove a network gameobject, you must be the owner, or you must be the masterClient.

Bye,

 Jean

KillerCreeper

  • Playmaker Newbie
  • *
  • Posts: 38
    • View Profile
Re: Photon Failed To Network Remove Gameobject
« Reply #4 on: June 12, 2019, 11:18:48 AM »
Hi,

 the error says: Client is neither owner nor masterClient taking over for owner who left:

 in order to remove a network gameobject, you must be the owner, or you must be the masterClient.

Bye,

 Jean

How would I fix this, though? I need it so when a player picks up an item, it removes the item for all players. The network remove gameobject action was the only way I found that does that.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14126
  • Official Playmaker Support
    • View Profile
Re: Photon Failed To Network Remove Gameobject
« Reply #5 on: June 13, 2019, 04:45:48 AM »
Hi,

 you need to do that when you are the owner, a player can not affect what is owned by another player, and only the masterclient is assigned the "admin" role where he can actually do this.

 so, I would look in your logic as to why a player wants to delete an object that doesn't belong to himself. and fix this.

If you want to remove an item for all players, then during the logic where you do that, only the masterclient will execute this. other player will be passive in this process.

so when a player picks up an item, you need to send an rpc to the MasterClient, and the masterClient will deal with this. you can alternatively send an rcp to ALL and each will delete its owned item related to the picked up item mentionned in the RPC.

 Bye,

 Jean


KillerCreeper

  • Playmaker Newbie
  • *
  • Posts: 38
    • View Profile
Re: Photon Failed To Network Remove Gameobject
« Reply #6 on: June 14, 2019, 06:16:33 PM »
Hi,

 you need to do that when you are the owner, a player can not affect what is owned by another player, and only the masterclient is assigned the "admin" role where he can actually do this.

 so, I would look in your logic as to why a player wants to delete an object that doesn't belong to himself. and fix this.

If you want to remove an item for all players, then during the logic where you do that, only the masterclient will execute this. other player will be passive in this process.

so when a player picks up an item, you need to send an rpc to the MasterClient, and the masterClient will deal with this. you can alternatively send an rcp to ALL and each will delete its owned item related to the picked up item mentionned in the RPC.

 Bye,

 Jean

Okay so I am watching this tutorial to see how to do rpc sending and such:
First, at 7:39, he does not use a transition for if the player is not mine. How would that work for the second player joining? That would essentially mean he could not shoot whatsoever.

Also, at 18:15, he sets a global transition to all photon targets, which the global transition is on an empty game object already in the scene. I did this and it didn't call that global transition.

I am using "Photon View RPC Broadcast FSM Event With Data" to carry the game object over to the empty game object, "Item Pickup Manager." The problem is now, it won't call the remote event that I set it to.

KillerCreeper

  • Playmaker Newbie
  • *
  • Posts: 38
    • View Profile
Re: Photon Failed To Network Remove Gameobject
« Reply #7 on: June 15, 2019, 01:50:45 PM »
I found out that it won't call the remote event because "Photon View RPC Broadcast FSM Event With Data" is broken? I tried "Photon View RPC Broadcast FSM Event" and it works but with data doesn't work, for some reason.

KillerCreeper

  • Playmaker Newbie
  • *
  • Posts: 38
    • View Profile
Re: Photon Failed To Network Remove Gameobject
« Reply #8 on: June 16, 2019, 11:48:12 AM »
Why, with Photon, is it easier to create objects than destroy them... I've been trying to fix this for so long but I haven't come across any solution...

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14126
  • Official Playmaker Support
    • View Profile
Re: Photon Failed To Network Remove Gameobject
« Reply #9 on: June 17, 2019, 12:41:05 AM »
Hi,

 It would be best to create a post per questions, it will be easier to answer and track progress on resolutions.

- about RPC, I am not aware of any issues with them actions, can you try to isolate this, because it's likely a mix up

- Destroying is also fine, but I guess it depends the context, can you explain a bit more about the setup for the network object you are trying to destroy and how it doesn't work, and what you would expect happening, depending on the context, it cna be tricky ( like you can't destroy something that is no yours, unless youa re the master, so you test with one player, it's fine, but then if you test with more, it starts not working because only one of them is the master)

Bye,

 Jean


Bye,

 Jean

KillerCreeper

  • Playmaker Newbie
  • *
  • Posts: 38
    • View Profile
Re: Photon Failed To Network Remove Gameobject
« Reply #10 on: June 17, 2019, 11:33:17 AM »
Hi,

 It would be best to create a post per questions, it will be easier to answer and track progress on resolutions.

- about RPC, I am not aware of any issues with them actions, can you try to isolate this, because it's likely a mix up

- Destroying is also fine, but I guess it depends the context, can you explain a bit more about the setup for the network object you are trying to destroy and how it doesn't work, and what you would expect happening, depending on the context, it cna be tricky ( like you can't destroy something that is no yours, unless youa re the master, so you test with one player, it's fine, but then if you test with more, it starts not working because only one of them is the master)

Bye,

 Jean


Bye,

 Jean

I am trying to make it so when a player picks up an item, it destroys the item for every player. Exactly what you said is what is happening. It works for the first person who joins but since the second is not the master client, it doesn't work. When picking up an item, it has a "Photon Is Mine" action. If yes, it destroys the object for everyone. If no, it sends an RPC to the master client.
My problem is: Where do I put the global transition that I want to send to the master client? I tried making an empty game object on the scene with it but that didn't work. I tried making one onto all players but that didn't work either.

I think one of the reasons it is not working is because it won't let me send what item the player picked up to the master client. I tried using "Photon View RPC Broadcast FSM Event With Data" but it doesn't send the event through.
"Photon View RPC Broadcast Fsm Event" on the other hand, does send the event through.
The action, "Photon View RPC Broadcast FSM Event With Data" seems like it is broken to me. The only reason I need "Photon View RPC Broadcast Fsm Event With Data" is so I can send the game object that the player picked up to the master client so the master client knows what to destroy.
« Last Edit: June 17, 2019, 11:36:01 AM by KillerCreeper »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14126
  • Official Playmaker Support
    • View Profile
Re: Photon Failed To Network Remove Gameobject
« Reply #11 on: June 18, 2019, 09:08:52 AM »
Hi,

 you just send an rpc to ALL, and then all players receive it, but they all check if they are the master and only the master will proceed.

 Bye,

 Jean

KillerCreeper

  • Playmaker Newbie
  • *
  • Posts: 38
    • View Profile
Re: Photon Failed To Network Remove Gameobject
« Reply #12 on: June 18, 2019, 10:55:53 AM »
Hi,

 you just send an rpc to ALL, and then all players receive it, but they all check if they are the master and only the master will proceed.

 Bye,

 Jean

How could I send the game object that needs to be destroyed through, though? Like I said above, "Photon View RPC Broadcast Fsm Event With Data" won't send the event through for some reason.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14126
  • Official Playmaker Support
    • View Profile
Re: Photon Failed To Network Remove Gameobject
« Reply #13 on: Today at 12:43:43 AM »
Hi,

 you can't send a gameobject as a variable of an RPC, you need to send the viewID or a reference as a string, that other players can use to find the gameobject you want to destroy.

 Is the game object you want to destroy a networked gameobject?

can you show the state and action where you use that action?

 Bye,

 Jean

KillerCreeper

  • Playmaker Newbie
  • *
  • Posts: 38
    • View Profile
Re: Photon Failed To Network Remove Gameobject
« Reply #14 on: Today at 10:27:53 AM »
Hi,

 you can't send a gameobject as a variable of an RPC, you need to send the viewID or a reference as a string, that other players can use to find the gameobject you want to destroy.

 Is the game object you want to destroy a networked gameobject?

can you show the state and action where you use that action?

 Bye,

 Jean

The game object I want to destroy may be networked game object. I don't know how it would be considered a networked game object or not. I have the objects on scene first. But when you pick them up, you can drop them and I use Photon Network Instantiate for that.

I think I have gotten it working, though, I haven't tried with two players yet. Here's what I did.

The first image is on the Inventory Manager, on the player.
The second is on an empty game object on the scene.