Projectiles don't instantiate or sync properly.

Hi,

I am having some problems instantiating and syncing my Projectiles across the network. I have set up my Scene, Players, Weapons and Projectiles according to the documentation and I can get my Players to spawn correctly into the same Room, but when I try to fire my Projectile Weapon, there are massive inconsistencies, delays and failed instantiations across the 2 different game instances.

This seems to be quite a common problem in UCC PUN as I've seen a few other players sitting with the same problem. I just wanted to check if anyone has constructed a basic step by step process on how to set up Projectile Instantiations across the Network?

Please, any help on the matter would be greatly appreciated as this issue has held me back immensely so far.
 
This issues also happens for the Objects Instantiated when a Projectile get's destroyed (Spawned Objects on Destroy) and not just the Projectiles themselves, but they seems to be particularly out of sync with these objects.
 
I haven't seen this occur before so if you can list the steps to reproduce from a fresh project I can take a look. Also, if you use the demo projectiles does it work? If it does then I would compare your projectile to the demo projectile to see what the difference is.
 
Hi, Thanks for the reply and the help, I really appreciate it!

Unfortunately, if I use the Arrow Projectile, I still get the same issue, the 1st Player shoots andsuncs the Projectile just fine but the second one's shots dont sync properly on either instance.

Using the Pun Demo Player along with the Arrow Projectile gives even less fruitful results, with the 2nd player Shooting visibly but no Arrow Projectiles even spawning at all.

I will try and document my entire setup from start to finish as best I can soon, I just need to get it all dow, but it is a pretty basic Top Down Third Person setup with a Stationary Camera.
 
Last edited:
So you are having a problem in the demo scene as well? If you create a new project does it work?
 
Hi Justin,

I creeated a new project from scratch and only imported and set up the Opsive Third Person Controller and the PUN Multiplayer Add-On (along with running the project setup). Then I proceeded to the Menu scene, trying to start a game but noticed that the player model gets spawned but if I move then it just walks forward no matter what direction I am pressing and the Camera wouldnt attach onto the Character either.

In order to fix this issue I had to set the Camera in the DemoRoom scene to Auto Initialize the Character as it was turned off in the DemoRoom's Camera for some reason and that was the only way I could get the Spawned character to get bound by the Camera and be able to move, turn and aim properly.

However, even after getting the newly created DemoRoom to run properly, I am still getting issues with the 2nd Player's Projectile Shooting, I made a duplicate of the PUN Arrow prefab and had the Character use that as a Projectile for the Rifle weapon. The 1st player shoots the Projectiles from the Assault Rifle just fine (on both instances), but the 2nd Player's first couple of shots don't spawn at all and then it gradually gets better and more accurate the more I use the 2nd Player's Assault Rifle but will still occasionally skip from spawning some of the projectiles and sometimes heavily delayed as well.

I'm also not sure how to switch the Camera and the Character properly to Top-Down properly, I set the Movement type of the Character to Top Down and I set the Camera's View Type to Top Down as well, but the Player and camera still spawns as a Normal Third Person Character/Camera setup?

I am using Unity 2019.4.28, the latest version of Opsive Third Person Controller as well as the latest PUN version (running Windows 10 Pro 64bit).
 
Last edited:
Ok cool, I just found a way to replicate the issue in the Demo Scene.

1. Start a Fresh Project and import the Opsive Third Person Controller.
2. Setup the Project (Button Mappings and Layers)
3. Import PUN and the Opsive PUN Add-On and set up the project for PUN.
4. Go to DemoRoom scene and notice that the Init Character On Awake tickbox isnt checked and this seems to be necessary to spawn the player correctly (otherwise, the Camera doesnt attach to the player and the Player's movement orientation is also weird).
5. Go back to the Menu Scene.
6. Then proceed to the Nolan Pun player prefab and add the Arrow Pun prefab to the Assault Rifle's Projectile Prefab slot.
7. Make sure the Menu scene is the first scene in the Build Scenes with the DemoRoom being the second and also that the MenuManager points to the Demo Room and then build the game out.
8. Run 2 different copies of the game and connect to the same room to get a Master and Client.
9. Hold in Fire for the 1st (Master) Player with the Assault Rifle and notice that the Arrow Pun prefabs spawn correctly and smoothly.
10. Then with the 2nd Player hold in the trigger until all clips are depleted and notice that the Arrow Pun Prefab doesn't always spawn with each shot, even though a shot was fired and subtracted from the Ammo, the Muzzle Flash and Shell prefabs are spawning, its just the Projectile Prefab not spawning.

I also tried to set the Projectile to Initialize On Awake and this seems to make a small difference but doesn't solve the issue either.

This issue is exactly the same as the one described in this thread:

The only difference being that I set the Arrow Pun prefab to the Assault Rifle, making it easier to replicate the issue than using the Bow.

Hope that the above explanation helps in replicating the issue, otherwise, I can record a video if you can't replicate the issue with the above steps.
 
Last edited:
Ok cool, I just found a way to replicate the issue in the Demo Scene.

1. Start a Fresh Project and import the Opsive Third Person Controller.
2. Setup the Project (Button Mappings and Layers)
3. Import PUN and the Opsive PUN Add-On and set up the project for PUN.
4. Go to DemoRoom scene and notice that the Init Character On Awake tickbox isnt checked and this seems to be necessary to spawn the player correctly (otherwise, the Camera doesnt attach to the player and the Player's movement orientation is also weird).
5. Go back to the Menu Scene.
6. Then proceed to the Nolan Pun player prefab and add the Arrow Pun prefab to the Assault Rifle's Projectile Prefab slot.
7. Make sure the Menu scene is the first scene in the Build Scenes with the DemoRoom being the second and also that the MenuManager points to the Demo Room and then build the game out.
8. Run 2 different copies of the game and connect to the same room to get a Master and Client.
9. Hold in Fire for the 1st (Master) Player with the Assault Rifle and notice that the Arrow Pun prefabs spawn correctly and smoothly.
10. Then with the 2nd Player hold in the trigger until all clips are depleted and notice that the Arrow Pun Prefab doesn't always spawn with each shot, even though a shot was fired and subtracted from the Ammo, the Muzzle Flash and Shell prefabs are spawning, its just the Projectile Prefab not spawning.

I also tried to set the Projectile to Initialize On Awake and this seems to make a small difference but doesn't solve the issue either.

This issue is exactly the same as the one described in this thread:

The only difference being that I set the Arrow Pun prefab to the Assault Rifle, making it easier to replicate the issue than using the Bow.

Hope that the above explanation helps in replicating the issue, otherwise, I can record a video if you can't replicate the issue with the above steps.
Hi did you fix the synching?
 
Hi did you fix the synching?
I got a code fix from Justin via email, I think he still needs to implement it in an update, just contact him for the fix. Also keep in mind, this doesnt solve the issue entirely as there still seems to be a slight half-second delay, although Justin says this is on PUN's side not UCC, so I still need to contact PUN to check how I can alleviate the delays.
 
Top