Hello, I am using Unity 2022.3.49f1 with mirror. I am creating online shooter with active ragdoll system. Game is very raw and right now I have only one gun (revolver) in it. also this weapon is already in the player’s hand at startup. when the player shoots, ray comes out the gun and checks if it hit the player. If it hits player then the method with Command attribute CmdDamageHit(attached files(Gun)) is launched, which first looks at connectionToClient.isReady, if it is true then it launches method RpcChangeHealth(attached files(Gun)) with TragetRpc attribute that change other player’s health, if it’s false, then it’s waiting till it gonna be true.
I have this scripts: Gun(Pastie.io), RevolverGun that inherits Gun class(Pastie.io), and also PlayerScript(Pastie.io)
When I shoot on the host first time I have this error: Disconnecting connection: connection(0) because handling a message of type Mirror.CommandMessage caused an Exception. This can happen if the other side accidentally (or an attacker intentionally) sent invalid data. Reason: System.NullReferenceException: Object reference not set to an instance of an object at Gun.UserCode_CmdDamageHitSingleRaycastHit (System.Single damage, UnityEngine.RaycastHit hit) [0x00011]
when i shoot second time i get this error: Command System.Void Gun::CmdDamageHit(System.Single,UnityEngine.RaycastHit) called on revolver while NetworkClient is not ready. This may be ignored if client intentionally set NotReady.
When I shoot while im client i get this error and then im automaticly disconecting: isconnecting connection: connection(1) because handling a message of type Mirror.CommandMessage caused an Exception. This can happen if the other side accidentally (or an attacker intentionally) sent invalid data. Reason: System.NullReferenceException: Object reference not set to an instance of an object
at Gun.UserCode_CmdDamageHitSingleRaycastHit