Search Unity

Trying to grab NetworkIdentity objects from a pool on the client side rather than instantiating them

Discussion in 'Connected Games' started by Doghelmer, Feb 8, 2018.

  1. Doghelmer

    Doghelmer

    Joined:
    Aug 30, 2014
    Posts:
    112
    When a Network Identity object is spawned on the client, it is always instantiated from a prefab. This seems to be done through the following line in ClientScene.cs:

    var obj = (GameObject)Object.Instantiate(prefab, s_ObjectSpawnMessage.position, Quaternion.identity);

    Rather than instantiating the object, I'd like to run my own function in place of this line, to grab the gameobject from a pool.

    Is there any way to effectively extend ClientScene.cs, the way it's possible to extend NetworkManager? It seems like the simplest way to achieve my pooling goal would be if I were able to replace this one line in ClientScene.cs, but I'm a little confused as to whether this is somehow possible. Is there a more standardized way to achieve what I'm trying to achieve here?
     
  2. kienbb

    kienbb

    Joined:
    Sep 10, 2014
    Posts:
    12
unityunity