How to disable/enable gameobject for all clients?

Options
Hi,
i'm using object pooling for spawning a huge amount of enemies. When you are using object pooling a big amount of enemies gets spawned and disabled. You can simply enable enemies if you need some and when they got killed you disable them, reset stats and they are ready to get used again. This way you improve performance and memory.

However, my enemies are spawned and disabled for the local player but for the other players all (200) enemies are enabled → resulting in painful lags.

What is a good way to fix this? Should I use a raise event to tell every client which enemies got enabled/disabled (how to do it? I can't serialize gameobjects in a raise event).

Just need some input :)

Greets and thank you

Comments

  • Jaudatus
    Jaudatus
    edited December 2018
    Options
    I figured it out myself:

    I disabled the enemie in the enemie script Awake method and enabled them by using an RPC and the enemies photonview id.

    Greets