Unable to instantiate properly while playing PUN2 Free

Hey guys, so I'm making a RTS style game, and when I try to instantiate my troops they always instantiate at 0,0,0 when trying to instantiate using raycasting, is there something i'm missing? i tried using OnSerializedView to call the vector over the network, Do i need to send the vector to the server using an RPC or something? I haven't been able to really use RPC since i've been doing everything over OnSerlializedView

Comments

  • I was able to resolve this pretty easily after thinking about it.

    So in order for you to transform.position an object it has to be on the gameobject you are controlling, And for some reason when you click the mouse button it doesn't instantly update the position, so i was able to make this work by having my transform position sent to my spawning script and call my spawn position from that vector instead of from the outside script.

    if you know if a better way to do this, let me know, for some reason photon doesn't allow or doesn't read the position fast enough to spawn at the mouse location vector from a seperate script.