Client RPC and Async working together

I’ve got a project where I’m trying to work with some of the new UGS and Netcode for gameobjects, and I’ve hit a conundrum. I use Netcode to call a client rpc function, then that function needs to call an async Task function to handle some UGS stuff. Problem is, I can’t figure out how to call the async function properly. (I’m still a bit new to async Task) If I just put code like this:

[ClientRpc]
public void CallingClientRpc()
{
   CallAsyncFunc();
}

async Task CallAsyncFunc()
{
   //await something
}

so doing this will tell me that the CallAsyncFunc will not be running asynchronously, so it won’t do all the code it actually needs to do. It tells me to add an await when calling it. But here is the conundrum: I can’t do: “await CallAsyncFunc()” because the client rpc can’t be async. So I am not sure what to do here. I tried adding in another function to run between the two, but its still the same problem.

I am sure the answer is something incredibly basic about async that I have missed, or just don’t know about. Sorry in advanced if this is incredibly simple haha.

async Task CallAsyncFunc() returns a Task that can be awaited. But since the ClientRpc cannot be async, the returned Task cannot be awaited.

In your case you just want to fire and forget.
So change it to async void CallAsyncFunc()

I KNEW it was going to be something simple haha. Thanks for the info, and the explanation! I’m still wrapping my head around async and Tasks, but that explanation makes a lot of sense.