Network spawning with object pool question

ChristianWiele

Active member
Hi,

I try to spawn an object over the network using the (PUN)ObjectPool in the following way:

1.) object added to the PunObjectPool
2.) Instantiate on the master with ObjectPool.Instantiate(GO, position, rotation)
3.) Network spawn with NetworkObjectPool.NetworkSpawn(...)

This all works fine, except for one thing. I destroy the object, and it is put back into the pool (with NetworkObjectPool.Destroy). If I spawn it again, the object is taken from the pool on the client, but the transform is not synced with spawning. As a result, the object is spawned at the old position (at which it was destroyed), and only after the first sync through the photon view, it appears at the new spawn position.

Is this a bug, or am I doing it the wrong way?

Regards, Christian
 
You'll need to manually sync the location. As an example the shootable weapon's projectile component will sync when the Use event is called.
 
Can you be more specific? In the shootable weapon script the projectile is spawned in the ProjectileFire method. And is done exactly as I do it, without any sync.
 
Top