Allocate Callback

Allocate Callback is a cold processing mechanism,
I was testing the Allocate event yesterday and received it once,
The next test did not receive the Allocate event.

Then I looked at the FusionBr200 project,
It is written in Start connecting to the game directly after SubscribeToServerEventsAsync
And it says: “It’s possible this is a cold start allocation”,
I laughed out loud on the spot.

So here are some references for you, thank you.

// Setup allocations
_multiplayEventCallbacks = new MultiplayEventCallbacks();
_multiplayEventCallbacks.Allocate += OnAllocate;
_multiplayEventCallbacks.Deallocate += OnDeallocate;
_multiplayEventCallbacks.Error += OnError;
_serverEvents = await MultiplayService.Instance.SubscribeToServerEventsAsync(_multiplayEventCallbacks);

// It's possible this is a cold start allocation (no event will fire)
if (!string.IsNullOrEmpty(MultiplayService.Instance.ServerConfig.AllocationId))
{
    await StartGame();
}
1 Like

Hello,

Could you provide some more details about the way in which you were testing the allocate event?

  1. Were you using test allocations or the Allocate API (Unity Services Web API docs) directly?
  2. After the first allocate event, did you stop or deallocate that server before trying to allocate it again?

1.They are all in accordance with the formal, direct test function

2.First Test allocations, manually shut down the server.
Then start the formal matching process.

I have come across the same issue but with just test allocations,

  1. Start test allocation, OnAllocate never fires (even though its been allocated)
  2. Deallocate manually (through the test allocation) - OnDeallocate fires off
  3. Start test allocation again, OnAllocate fires this time and everything proceeds as normal

tested this in both start and awake methods, same result.

Thank you for providing this! Was able to temporarily fix it on my end.

from our Server logs it seems like the system does not get past the SubscribeToServerEventsAsync function.

This happens randomly. After some allocations and deallocations.