Quantcast
Channel: Recent Discussions — Photon Engine
Viewing all articles
Browse latest Browse all 15755

How to destroy a TrueSyncBehavior GameObject? doc code doesn't work.

$
0
0
Hi Everyone,

the documentation seems to have a simple way to destroy a TrueSyncBehavior behavior using

public void OnSyncedCollisionEnter(GameObject other) { Destroy(other); }

but that doesn't work, it creates this error:

MissingReferenceException: The object of type 'GameObject' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
TrueSync.LayerCollisionMatrix.CollisionEnabled (UnityEngine.GameObject goA, UnityEngine.GameObject goB) (at Assets/TrueSync/Unity/LayerCollisionMatrix.cs:32)
TrueSync.PhysicsWorldManager.IsCollisionEnabled (IBody rigidBody1, IBody rigidBody2) (at Assets/TrueSync/Unity/PhysicsWorldManager.cs:277)
TrueSync.World.CanBodiesCollide (TrueSync.RigidBody body1, TrueSync.RigidBody body2)
TrueSync.CollisionSystem.CheckBothStaticNonKinematic (IBroadphaseEntity entity1, IBroadphaseEntity entity2)
TrueSync.CollisionSystemPersistentSAP.Detect (Boolean multiThreaded)
TrueSync.World.Step (FP timestep, Boolean multithread)
TrueSync.PhysicsWorldManager.UpdateStep () (at Assets/TrueSync/Unity/PhysicsWorldManager.cs:76)
TrueSync.AbstractLockstep.ExecutePhysicsStep (System.Collections.Generic.List`1 data, Int32 syncedDataTick)
TrueSync.AbstractLockstep.Update ()
TrueSync.TrueSyncManager.FixedUpdate () (at Assets/TrueSync/Unity/TrueSyncManager.cs:703)


the only way seems to be using TrueSyncManager.SyncedDestroy(this.gameObject);

BUT, is it not an overhead? as I am already within a synched callback?

Bye,

Jean

Viewing all articles
Browse latest Browse all 15755

Trending Articles