Are objects instanced with PhotonNetwork.InstantiateSceneObject() ?

Options
This maybe a stupid question..

This method returns a GameObject, this is fine for my purposes but I'm curious does it (or any related method) actually leverage Unity's internal instancing. Reason being I'll be using it for procedurally placing trees.

Comments

  • vadim
    Options
    Each InstantiateSceneObject call creates Unity GameObject (with GameObject.Instantiate call) on every client joined to the room.
    If number of such objects is large and synchronization between them is not required (except creation and removal), like for trees in the forest, better do not use network-synchronized objects to save resources. Instead, synchronize array of trees positions (via room property or RPC) and instantiate and destroy them locally as plain Unity GameObjects.
  • Well part of my mechanic is that tree's can be cut down and they affect terrain movement, so I need to keep track of every single one on each client.
  • vadim
    Options
    My point was that you do not need PhotonView per tree to keep track of every tree. Synchronizing array with every tree positions should be enough.
  • philip_atha
    edited November 2015
    Options
    Ok, Thanks vadim I'll give that a shot. Although I'm still curious, are the Transforms I'll be passing instanced directly to the GPU?
  • vadim
    Options
    I did not understand the question. On every tree array update, you instantiate or destroy tree objects with Unity methods. No PUN required since you get up-to-date tree list.