OnOwnershipTransfer triger fires when any ownership transfer happend
closed
naqtn
VRChat 2018.2.1 introduced OnOwnershipTransfer trigger. https://docs.vrchat.com/docs/vrchat-201821
> OnOwnershipTransfer - Used to detect when the ownership of an ObjectSync object ha changed
But, this OnOwnershipTransfer trigger fires when the ownership of
any
ObjectSync objects in the scene has changed.Excepting a case that has only one ObjectSync object in the scene, this is useless. Especially, prefabs can't use this trigger because they can't put assumption of another ObjectSync objects.
Log In
Ruuubick - Designer
closed
CyanLaser
This canny can be closed.
OnOwnershipTransfer fires only on the client which lost ownership of an object. The trigger appears to be fixed but there is no documentation on intended behavior. https://docs.vrchat.com only mentions this trigger in the update notes when it was introduced and nowhere else.
Created new cannys that are related and would help creators:
Ruuubick - Designer
in progress
CyanLaser
This is still an issue and now causes an exception when used. The order in which OnOwnershipTransfer seems to be random. Every time I join my test instance, only one object receives the event and the object is different every time.
Here is the exception thrown. I picked up the object called "PickupRand" and the object "Test 1" receives the event. "Test 1" doesn't even have the object sync component.
2019.01.09 20:14:17 Log - [NetworkManager] OnOwnershipTransfered PickupRand from 3 to 3
2019.01.09 20:14:17 Log - [VRC_TriggerInternal] 220.5992 Test 1 via OnOwnershipTransfer executing [SetGameObjectActive (True, 0.000, 0, "GreenT1", , 0)]
2019.01.09 20:14:17 Warning - [VRC_TriggerInternal] GreenT1 deferred event Unnamed type OnEnable because nothing
2019.01.09 20:14:17 Exception - InvalidOperationException: HashSet have been modified while it was iterated over
System.Collections.Generic.HashSet
1+Enumerator[UnityEngine.Events.UnityAction
3[UnityEngine.GameObject,VRC.Player,VRC.Player]].CheckState ()System.Collections.Generic.HashSet
1+Enumerator[UnityEngine.Events.UnityAction
3[UnityEngine.GameObject,VRC.Player,VRC.Player]].MoveNext ()CGOBAMHLMGD[UnityEngine.GameObject,VRC.Player,VRC.Player].JJKEKBMHGIL (UnityEngine.GameObject DCKPOHKFHHF, VRC.Player BMKFLDFMFPK, VRC.Player OAGFMFAHPGA)
NetworkManager+AOFGJPCDMIM.PNOKAEINNED ()
VRC.VRCWorker.DispatchToMain (System.Action DBCLEMEGGED, Boolean BJFCCLLHDAN)
NetworkManager.OnOwnershipTransfered (System.Object[] CLDIJFPIKKH)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture)
System.MonoType.InvokeMember (System.String name, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object target, System.Object[] args, System.Reflection.ParameterModifier[] modifiers, System.Globalization.CultureInfo culture, System.String[] namedParameters)
UnityEngine.SetupCoroutine.InvokeMember (System.Object behaviour, System.String name, System.Object variable)
UnityEngine.GameObject:SendMessage(String, Object, SendMessageOptions)
OEHMHPKGHGG:CGOPAJFNPJO(DCLLFHIPOFN, Object[])
OEHMHPKGHGG:OnEvent(EventData)
LHMLPDBJDMD:OnEvent(EventData)
ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback(Byte[])
ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands()
ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands()
LHMLPDBJDMD:DispatchIncomingCommands()
PhotonHandler:Update()
CyanLaser
Here is a test world featuring this version of the bug.
wrld_bda2500a-28fa-489b-a080-7331db9473ea
There are 4 triggers with OnTransferOwnership and each will activate a green orb showing when the trigger fires.
- No object sync, just the trigger.
- Pickup with no object sync
- Pickup with object sync
- Object sync and trigger only
With multiple people, only one of these will fire which may be different per person. Looking at the logs, you get the error above.
Error - [Network Transport] HashSet have been modified while it was iterated over
Ruuubick - Designer
tracked