Unity Crash on Rpc with NetworkStruct parameter

wilbil741
wilbil741
edited March 2022 in Fusion

I have an Rpc with the following signature:

       [Rpc(RpcSources.InputAuthority, RpcTargets.All)]

       public void Rpc_Cast(TargetData targetData)

TargetData is like so:

   [Serializable]

   public struct TargetData : INetworkStruct

   {

       public Character target; //Character is a NetworkBehaviour

       public Vector3 position;

   }

Crash dump says "The thread tried to read from or write to a virtual address for which it does not have the appropriate access."

Does anyone have any clue about the problem or is this a bug?

Thank you

Answers

  • I solved it!

    Apparently you cannot make a Component null check on an RPC Component Parameter.

    For example in my case I would do if(targetData.Character != null)

This discussion has been closed.