Updating prefabs in-game? (PunRPC question)

Hi,

I'm trying to PunRPC (send updates in-game with photon to all other players) the weapons changes/upgrades that happen during gameplay, but I'm missing something:

[code=CSharp] [PunRPC]
void OnTriggerEnter(Collider other)
{
if (photonView.isMine)
{
if (other.tag == "BeeSting")
{


beePrefab.SetActive(true);
}[/code]
In my code above, the "beePrefab" (a missile that is a child object on each player) becomes active and should be visible to all other players, when the player smashes the "BeeSting" crate (OnTriggerEnter)

But it doesn't work and I know I'm missing something as it is not enough to write [PunRPC] above the function. How do I show all other players these weapons updates in-game?

Comments

  • Does anybody know the answer to this?
  • Nobody??
  • Hi @petersenjmp,
    if my suggestion is correct your trouble has nothing to do with PUN/Photon per se.

    Prefabs in Unity are kind of "blueprints" to create real objects. Thus it doesn't make sense to change prefabs, you should change real object instead (created from the prefab).

    Formatted code makes life a little easier for people who spend time trying to understand your question, btw.