PhotonNetwork.Instantiate not working (Unity / Pun2)

Options
I currently have a problem with trying to instantiate spell prefabs. At first I guess the best thing is to show the used code:
public abstract class BaseSpell : ScriptableObject {
    protected GameObject spawnSpellPrefab() {
        var newSpellObject = PhotonNetwork.Instantiate(spellPrefab.name, new Vector3(0, 0, 0), Quaternion.identity, 0);
        SpellPoolManager.instance.addTimedObjectToPool(newSpellObject, despawnTime);
        return newSpellObject;
    }
}
(Note that the SpellPoolManager does not cause this)
Then I have subclasses of the baseclass that then use the spawnSpellPrefab to Instantinate the Prefab:
public class SFireBall {
    protected override void onKeyUp() {
        var newSpellObject = spawnSpellPrefab();
        [...]
    }
}
Those spells are referenced by the player which then can spawns those per key press which works perfectly fine both in offline and the local client that initiates the spell. However the other player does not see the spell at all. Following error message appears:
Received OnSerialization for view ID 2002. We have no such PhotonView! Ignored this if you're leaving a room. State: Joined

The spellPrefab, which is supposed to spawn, has a PhotonView Script attached and rests in the Resources Folder. I have red through the tutorial page (https://doc.photonengine.com/en-us/pun/v2/gameplay/instantiation) now at least a dozen times and still can't figure out what the problem is.
Here is the spellPrefab Inspector:
Inspector View
So either I'm doing something completely wrong, or you can only Instantiate Prefabs from an active GameObject, still thank you in advance for you help and time!

Comments

  • Tobias
    Options
    I don't think we can really help here. It's something to do with your project.

    Note that the remote players won't run spawnSpellPrefab(). That means, the others don't set a despawnTime.

    Maybe you simplify the prefab you'd instantiate and add features one by one. Check which addition makes it disappear.