How to activate and deactivate child gameobjects?

Options
In my game the parent player gameobject can equip different weapons. This is achieved by turning on and off child gameobjects. For example, when i want to switch to a machine gun from a pistol. The pistol gameobject is turned off, and the machine gun gameobject turned on.

I have a photonview on the parent, and had assumed it would automatically update the children over the network. This wasnt the case. I also tried putting photonviews on each weapon child object, this also didn't work.

How should i go about getting this to work over the network?

NB: I should make it clear that this all works locally, it just doesnt network any changes.

Apologies if this is a rather basic question.

Comments

  • Hi Irae,

    I also tried putting photonviews on each weapon child object, this also didn't work.


    One PhotonView on the parent object should be enough in this case.
    There are multiple ways, to achieve what you want. One is to use OnPhotonSerializeView(...) function and store boolean values for each child object of the game object. A more or less comparable example for this can be found in the PUN Basics Tutorial.
  • Irae
    Options
    Thanks alot, got everything working.

    I somehow completely missed that entire tutorial series when looking through the documentation.