Brackeys / MultiplayerFPS-Tutorial

A video series on making a multiplayer first-person shooter in Unity.
The Unlicense
654 stars 287 forks source link

NullReferenceException(muzzleflash) #30

Open sanjyot-dahale opened 5 years ago

sanjyot-dahale commented 5 years ago

The error is as follows:

NullReferenceException: Object reference not set to an instance of an object PlayerShoot.RpcDoShootEffect () (at Assets/Scripts/PlayerShoot.cs:74)

Now the problem is that this error does not arise till the 2nd player joins the lobby. Once the second player joins the room, the 1st player(host of the room) starts getting this error.

So if I launch (host) the room from the Build and join the room from Unity itself, the Unity Player can do everything, but once he starts shooting, you cannot see his shooting in the Build game and the Build Player also cannot shoot and the NullReference error starts popping up. Then if the Unity Player kills the Build Player by shooting him, he only dies in the Unity Game and nothing happens in the Build Game.