Dedicated Servers Not Spawning Player Prefabs

Same issue that got called out previously and got a mystery solve, dedicated server no longer spawns player prefab, host version works fine. I’ve tried some variations and haven’t been able to get this working again.

ApprovalCheck and SpawnPlayerDelayed for reference. I threw a bunch of debug messages in there to see if I can figure out where things are getting hung up. Checked the server logs and it gets through the delay, but never past the instantiation of the gameobject.

    private void ApprovalCheck (NetworkManager.ConnectionApprovalRequest request, NetworkManager.ConnectionApprovalResponse response)
    {
        string payload = System.Text.Encoding.UTF8.GetString(request.Payload);
        UserData userData = JsonUtility.FromJson<UserData>(payload);

        // Store data
        _AuthIdViaClientId[request.ClientNetworkId] = userData.UserAuthId;
        _UserDataViaAuthId[userData.UserAuthId] = userData;
        OnUserJoin?.Invoke(userData);

        Debug.Log($"{this.GetType().Name}: {userData.UserName} connected and approved.");

        // If everything is good, create the player (possibly delayed) and approve the response.
        _ = SpawnPlayerDelayed(request.ClientNetworkId);
        response.Approved = true;
        response.CreatePlayerObject = false;
    }

    private async Task SpawnPlayerDelayed (ulong clientId)
    {
        Debug.LogWarning($"{this.GetType().Name}: SpawnPlayerDelayed.");

        await Task.Delay(1000);
        Debug.LogWarning($"{this.GetType().Name}: SpawnPlayerDelayed delay complete.");

        NetworkObject playerInstance = GameObject.Instantiate(_PlayerPrefab, SpawnPoint.GetRandomSpawnPoint(), Quaternion.identity);
        Debug.LogWarning($"{this.GetType().Name}: SpawnPlayerDelayed instantiation complete.");
        playerInstance.SpawnAsPlayerObject(clientId);
        Debug.LogWarning($"{this.GetType().Name}: SpawnPlayerDelayed spawn complete.");
    }

I’m probably going to set things up to use the automated spawning again while poking around for a fix, so that I can keep going :slight_smile:

Hi there,
So it is getting stuck on the line where it instantiates the PlayerPrefab?
Were there any errors logged in the server?
I would guess the player prefab reference might be null? If it’s missing that reference that could break everything.

No obvious errors in the log. I checked for null reference and the references to the player prefab are hooked up. This flow does work as expected for the host gameflow. Spawns the prefab delayed just fine. But switching over to the dedicated server flow it stops somewhere in the GameObject.Instantiate call.

I’ve reverted to the automatic spawning to keep rolling with the course, but I wanted to log this here in case other folks ran into the same issue that seems to have come up a couple of times. Happy to try some variants if it’ll be useful for debugging. Really easy to go back to the delayed setup.

Are you able to share your server logs? Perhaps I can spot something there?

Yeah, I’ll dig up the logs after I roll back my changes.

Matchplaylog.log:

Mono path[0] = '/game/Server_Data/Managed'
Mono config path = '/game/Server_Data/MonoBleedingEdge/etc'
Preloaded 'lib_burst_generated.so'
Initialize engine version: 2022.3.5f1 (9674261d40ee)
[Subsystems] Discovering subsystems at path /game/Server_Data/UnitySubsystems
Forcing GfxDevice: Null
GfxDevice: creating device client; threaded=0; jobified=0
NullGfxDevice:
    Version:  NULL 1.0 [1.0]
    Renderer: Null Device
    Vendor:   Unity Technologies
Begin MonoManager ReloadAssembly
- Loaded All Assemblies, in  0.109 seconds
- Finished resetting the current domain, in  0.002 seconds
ERROR: Shader Hidden/Universal Render Pipeline/Sampling shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
ERROR: Shader Hidden/Universal Render Pipeline/LutBuilderLdr shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
ERROR: Shader Hidden/Universal Render Pipeline/LutBuilderHdr shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
ERROR: Shader Hidden/Universal Render Pipeline/UberPost shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
ERROR: Shader Hidden/Universal Render Pipeline/Debug/DebugReplacement shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
ERROR: Shader Hidden/Universal/HDRDebugView shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
ERROR: Shader Hidden/Light2D-Shape shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
ERROR: Shader Hidden/Light2D-Shape-Volumetric shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
ERROR: Shader Hidden/Light2D-Point shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
ERROR: Shader Hidden/Light2d-Point-Volumetric shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
ERROR: Shader Hidden/ShadowProjected2D shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
ERROR: Shader Hidden/Shadow2DShadowSprite shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
ERROR: Shader Hidden/Shadow2DUnshadowSprite shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
ERROR: Shader Hidden/Shadow2DUnshadowGeometry shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
WARNING: Shader Unsupported: 'Hidden/Universal Render Pipeline/FallbackError' - All subshaders removed
WARNING: Shader Did you use #pragma only_renderers and omit this platform?
WARNING: Shader If subshaders removal was intentional, you may have forgotten turning Fallback off?
ERROR: Shader Hidden/Universal Render Pipeline/FallbackError shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
WARNING: Shader Unsupported: 'Hidden/Universal Render Pipeline/FallbackError' - All subshaders removed
WARNING: Shader Did you use #pragma only_renderers and omit this platform?
WARNING: Shader If subshaders removal was intentional, you may have forgotten turning Fallback off?
ERROR: Shader Hidden/Universal Render Pipeline/Stop NaN shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
ERROR: Shader Hidden/Universal Render Pipeline/SubpixelMorphologicalAntialiasing shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
ERROR: Shader Hidden/Universal Render Pipeline/GaussianDepthOfField shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
ERROR: Shader Hidden/Universal Render Pipeline/BokehDepthOfField shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
ERROR: Shader Hidden/Universal Render Pipeline/CameraMotionBlur shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
ERROR: Shader Hidden/Universal Render Pipeline/PaniniProjection shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
ERROR: Shader Hidden/Universal Render Pipeline/Bloom shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
ERROR: Shader Hidden/Universal Render Pipeline/TemporalAA shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
ERROR: Shader Hidden/Universal Render Pipeline/LensFlareDataDriven shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
ERROR: Shader Hidden/Universal Render Pipeline/Scaling Setup shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
ERROR: Shader Hidden/Universal Render Pipeline/Edge Adaptive Spatial Upsampling shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
ERROR: Shader Hidden/Universal Render Pipeline/FinalPost shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
ERROR: Shader Sprites/Default shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
ERROR: Shader Sprites/Mask shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
ERROR: Shader QFSW/Blur shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
ERROR: Shader TextMeshPro/Mobile/Distance Field shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
WARNING: Shader Unsupported: 'TextMeshPro/Distance Field' - All subshaders removed
WARNING: Shader Did you use #pragma only_renderers and omit this platform?
WARNING: Shader If subshaders removal was intentional, you may have forgotten turning Fallback off?
ERROR: Shader TextMeshPro/Distance Field shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
WARNING: Shader Unsupported: 'TextMeshPro/Distance Field' - All subshaders removed
WARNING: Shader Did you use #pragma only_renderers and omit this platform?
WARNING: Shader If subshaders removal was intentional, you may have forgotten turning Fallback off?
ERROR: Shader GUI/Text Shader shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
UnloadTime: 0.978242 ms
ERROR: Shader UI/Default shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
UI_PlayerNameEntryMenu: Player name changed: .
ERROR: Shader Legacy Shaders/Particles/Alpha Blended shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
WARNING: Shader Unsupported: 'Universal Render Pipeline/2D/Sprite-Lit-Default' - All subshaders removed
WARNING: Shader Did you use #pragma only_renderers and omit this platform?
WARNING: Shader If subshaders removal was intentional, you may have forgotten turning Fallback off?
ERROR: Shader Universal Render Pipeline/2D/Sprite-Lit-Default shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
WARNING: Shader Unsupported: 'Universal Render Pipeline/2D/Sprite-Lit-Default' - All subshaders removed
WARNING: Shader Did you use #pragma only_renderers and omit this platform?
WARNING: Shader If subshaders removal was intentional, you may have forgotten turning Fallback off?
WARNING: Shader Unsupported: 'Universal Render Pipeline/Particles/Unlit' - All subshaders removed
WARNING: Shader Did you use #pragma only_renderers and omit this platform?
WARNING: Shader If subshaders removal was intentional, you may have forgotten turning Fallback off?
ERROR: Shader Universal Render Pipeline/Particles/Unlit shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
WARNING: Shader Unsupported: 'Universal Render Pipeline/Particles/Unlit' - All subshaders removed
WARNING: Shader Did you use #pragma only_renderers and omit this platform?
WARNING: Shader If subshaders removal was intentional, you may have forgotten turning Fallback off?
Unloading 5 Unused Serialized files (Serialized files now loaded: 0)
UnloadTime: 18.165881 ms
Unloading 7 unused Assets to reduce memory usage. Loaded Objects now: 3456.
Total: 4.613411 ms (FindLiveObjects: 0.290079 ms CreateObjectMapping: 0.261588 ms MarkObjects: 3.989381 ms  DeleteObjects: 0.071875 ms)

Launch Args: 
-ip : 0.0.0.0
-port : 9000
-queryPort : 9010
Unloading 5 Unused Serialized files (Serialized files now loaded: 0)
UnloadTime: 0.874384 ms
Unloading 1 unused Assets to reduce memory usage. Loaded Objects now: 3980.
Total: 4.544196 ms (FindLiveObjects: 0.245916 ms CreateObjectMapping: 0.167700 ms MarkObjects: 4.095586 ms  DeleteObjects: 0.034282 ms)

ApplicationController: CreateServer task complete.
SQP server: SQP server started on 0.0.0.0:9010
[Wire]: Attempting connection on: ws://127.0.0.1:8086/v1/connection/websocket
[Wire]: Websocket connected to : ws://127.0.0.1:8086/v1/connection/websocket. Initiating Wire handshake.
Awaiting Allocation. Server Config is:
-ServerID: 66366974
-AllocationID: 94a86afa-bf30-4025-9d3d-8d60a299354c
-Port: 9000
-QPort: 9010
-logs: /mnt/unity/logs/
Config had AllocationID: 94a86afa-bf30-4025-9d3d-8d60a299354c
OnAllocation: 94a86afa-bf30-4025-9d3d-8d60a299354c
GetMatchmakerAllocationPayloadAsync:
{
  "matchProperties": {
    "teams": [
      {
        "teamName": "DefaultTeam",
        "teamId": "ad48550d-dc86-4c14-abf6-24322eada341",
        "playerIds": [
          "WMhA58vpbIrZTk8Yt53Py8kzNpKx"
        ]
      }
    ],
    "players": [
      {
        "id": "WMhA58vpbIrZTk8Yt53Py8kzNpKx",
        "customData": {
          "_Map": 0,
          "_GameMode": 0,
          "_GameQueue": 0
        }
      }
    ],
    "region": "da40ca46-74b3-410b-9388-4f0925d6c014",
    "backfillTicketId": "11787046-6992-4350-bffc-5fe4b52d7c4e"
  },
  "generatorName": "Solo Match",
  "queueName": "solo-queue",
  "poolName": "solo-pool",
  "environmentId": "bd499862-5003-419d-bc4c-90bc256b980f",
  "backfillTicketId": "11787046-6992-4350-bffc-5fe4b52d7c4e",
  "matchId": "93602310-41c2-4fe1-8c38-906dff72883d",
  "poolId": "63734729-bfa9-4a9f-b1ae-911dc772ffac"
}
Starting backfill Server: 1/20
Leaderboard: OnNetworkSpawn.
ApplicationController: StartGameServerAsync task complete.
User: Foge_Local - WMhA58vpbIrZTk8Yt53Py8kzNpKx already in Match. Ignoring add.
NetworkServer: Foge_Local connected and approved.
NetworkServer: SpawnPlayerDelayed.
NetworkServer: SpawnPlayerDelayed delay complete.
Can't stop backfilling before we start.
Leaderboard: OnNetworkDespawn.
Setting up 2 worker threads for Enlighten.
Leaderboard: OnDestroy.
Leaderboard: Leaderboard should be cleared up.
Can't stop backfilling before we start.
Memory Statistics:
[ALLOC_TEMP_TLS] TLS Allocator
  StackAllocators : 
    [ALLOC_TEMP_MAIN]
      Peak usage frame count: [0-1.0 KB]: 374 frames, [1.0 KB-2.0 KB]: 1 frames, [2.0 KB-4.0 KB]: 1 frames, [4.0 KB-8.0 KB]: 8 frames, [8.0 KB-16.0 KB]: 3 frames, [256.0 KB-0.5 MB]: 2 frames, [2.0 MB-4.0 MB]: 1 frames
      Initial Block Size 4.0 MB
      Current Block Size 4.0 MB
      Peak Allocated Bytes 2.5 MB
      Overflow Count 0
    [ALLOC_TEMP_Background Job.worker 4]
      Initial Block Size 32.0 KB
      Current Block Size 32.0 KB
      Peak Allocated Bytes 0 B
      Overflow Count 0
    [ALLOC_TEMP_Loading.PreloadManager]
      Initial Block Size 256.0 KB
      Current Block Size 256.0 KB
      Peak Allocated Bytes 37.2 KB
      Overflow Count 12
    [ALLOC_TEMP_Background Job.worker 3]
      Initial Block Size 32.0 KB
      Current Block Size 32.0 KB
      Peak Allocated Bytes 0 B
      Overflow Count 0
    [ALLOC_TEMP_Background Job.worker 11]
      Initial Block Size 32.0 KB
      Current Block Size 32.0 KB
      Peak Allocated Bytes 0 B
      Overflow Count 0
    [ALLOC_TEMP_Background Job.worker 7]
      Initial Block Size 32.0 KB
      Current Block Size 32.0 KB
      Peak Allocated Bytes 0 B
      Overflow Count 0
    [ALLOC_TEMP_Background Job.worker 6]
      Initial Block Size 32.0 KB
      Current Block Size 32.0 KB
      Peak Allocated Bytes 0 B
      Overflow Count 0
    [ALLOC_TEMP_Background Job.worker 12]
      Initial Block Size 32.0 KB
      Current Block Size 32.0 KB
      Peak Allocated Bytes 0 B
      Overflow Count 0
    [ALLOC_TEMP_Background Job.worker 2]
      Initial Block Size 32.0 KB
      Current Block Size 32.0 KB
      Peak Allocated Bytes 0 B
      Overflow Count 0
    [ALLOC_TEMP_Background Job.worker 9]
      Initial Block Size 32.0 KB
      Current Block Size 32.0 KB
      Peak Allocated Bytes 0 B
      Overflow Count 0
    [ALLOC_TEMP_Job.worker 0]
      Initial Block Size 256.0 KB
      Current Block Size 256.0 KB
      Peak Allocated Bytes 285 B
      Overflow Count 0
    [ALLOC_TEMP_Background Job.worker 10]
      Initial Block Size 32.0 KB
      Current Block Size 32.0 KB
      Peak Allocated Bytes 0 B
      Overflow Count 0
    [ALLOC_TEMP_Background Job.worker 8]
      Initial Block Size 32.0 KB
      Current Block Size 32.0 KB
      Peak Allocated Bytes 0 B
      Overflow Count 0
    [ALLOC_TEMP_Background Job.worker 15]
      Initial Block Size 32.0 KB
      Current Block Size 32.0 KB
      Peak Allocated Bytes 0 B
      Overflow Count 0
    [ALLOC_TEMP_Background Job.worker 1]
      Initial Block Size 32.0 KB
      Current Block Size 32.0 KB
      Peak Allocated Bytes 64 B
      Overflow Count 1
    [ALLOC_TEMP_EnlightenWorker] x 2
      Initial Block Size 64.0 KB
      Current Block Size 64.0 KB
      Peak Allocated Bytes 0 B
      Overflow Count 0
    [ALLOC_TEMP_Background Job.worker 13]
      Initial Block Size 32.0 KB
      Current Block Size 32.0 KB
      Peak Allocated Bytes 0 B
      Overflow Count 0
    [ALLOC_TEMP_Background Job.worker 5]
      Initial Block Size 32.0 KB
      Current Block Size 32.0 KB
      Peak Allocated Bytes 0 B
      Overflow Count 0
    [ALLOC_TEMP_AssetGarbageCollectorHelper]
      Initial Block Size 64.0 KB
      Current Block Size 64.0 KB
      Peak Allocated Bytes 0 B
      Overflow Count 0
    [ALLOC_TEMP_Background Job.worker 0]
      Initial Block Size 32.0 KB
      Current Block Size 32.0 KB
      Peak Allocated Bytes 0 B
      Overflow Count 0
    [ALLOC_TEMP_Background Job.worker 14]
      Initial Block Size 32.0 KB
      Current Block Size 32.0 KB
      Peak Allocated Bytes 0 B
      Overflow Count 0
    [ALLOC_TEMP_Loading.AsyncRead]
      Initial Block Size 64.0 KB
      Current Block Size 64.0 KB
      Peak Allocated Bytes 128 B
      Overflow Count 0
    [ALLOC_TEMP_BatchDeleteObjects]
      Initial Block Size 64.0 KB
      Current Block Size 64.0 KB
      Peak Allocated Bytes 0 B
      Overflow Count 0
[ALLOC_DEFAULT] Dual Thread Allocator
  Peak main deferred allocation count 617
    [ALLOC_BUCKET]
      Large Block size 4.0 MB
      Used Block count 1
      Peak Allocated bytes 1.8 MB
    [ALLOC_DEFAULT_MAIN]
      Peak usage frame count: [8.0 MB-16.0 MB]: 36 frames, [16.0 MB-32.0 MB]: 354 frames
      Requested Block Size 16.0 MB
      Peak Block count 2
      Peak Allocated memory 22.9 MB
      Peak Large allocation bytes 0 B
    [ALLOC_DEFAULT_THREAD]
      Peak usage frame count: [2.0 MB-4.0 MB]: 390 frames
      Requested Block Size 16.0 MB
      Peak Block count 1
      Peak Allocated memory 2.6 MB
      Peak Large allocation bytes 0 B
[ALLOC_TEMP_JOB_1_FRAME]
  Initial Block Size 2.0 MB
  Used Block Count 0
  Overflow Count (too large) 0
  Overflow Count (full) 0
[ALLOC_TEMP_JOB_2_FRAMES]
  Initial Block Size 2.0 MB
  Used Block Count 0
  Overflow Count (too large) 0
  Overflow Count (full) 0
[ALLOC_TEMP_JOB_4_FRAMES (JobTemp)]
  Initial Block Size 2.0 MB
  Used Block Count 1
  Overflow Count (too large) 0
  Overflow Count (full) 0
[ALLOC_TEMP_JOB_ASYNC (Background)]
  Initial Block Size 1.0 MB
  Used Block Count 1
  Overflow Count (too large) 0
  Overflow Count (full) 0
[ALLOC_GFX] Dual Thread Allocator
  Peak main deferred allocation count 0
    [ALLOC_BUCKET]
      Large Block size 4.0 MB
      Used Block count 1
      Peak Allocated bytes 1.8 MB
    [ALLOC_GFX_MAIN]
      Peak usage frame count: [32.0 KB-64.0 KB]: 389 frames, [64.0 KB-128.0 KB]: 1 frames
      Requested Block Size 16.0 MB
      Peak Block count 1
      Peak Allocated memory 108.2 KB
      Peak Large allocation bytes 0 B
    [ALLOC_GFX_THREAD]
      Peak usage frame count: [64.0 KB-128.0 KB]: 3 frames, [128.0 KB-256.0 KB]: 387 frames
      Requested Block Size 16.0 MB
      Peak Block count 1
      Peak Allocated memory 185.1 KB
      Peak Large allocation bytes 0 B
[ALLOC_CACHEOBJECTS] Dual Thread Allocator
  Peak main deferred allocation count 22
    [ALLOC_BUCKET]
      Large Block size 4.0 MB
      Used Block count 1
      Peak Allocated bytes 1.8 MB
    [ALLOC_CACHEOBJECTS_MAIN]
      Peak usage frame count: [1.0 MB-2.0 MB]: 389 frames, [8.0 MB-16.0 MB]: 1 frames
      Requested Block Size 4.0 MB
      Peak Block count 2
      Peak Allocated memory 13.5 MB
      Peak Large allocation bytes 9.5 MB
    [ALLOC_CACHEOBJECTS_THREAD]
      Peak usage frame count: [0.5 MB-1.0 MB]: 388 frames, [1.0 MB-2.0 MB]: 2 frames
      Requested Block Size 4.0 MB
      Peak Block count 1
      Peak Allocated memory 1.2 MB
      Peak Large allocation bytes 0 B
[ALLOC_TYPETREE] Dual Thread Allocator
  Peak main deferred allocation count 0
    [ALLOC_BUCKET]
      Large Block size 4.0 MB
      Used Block count 1
      Peak Allocated bytes 1.8 MB
    [ALLOC_TYPETREE_MAIN]
      Peak usage frame count: [8.0 KB-16.0 KB]: 390 frames
      Requested Block Size 2.0 MB
      Peak Block count 1
      Peak Allocated memory 13.8 KB
      Peak Large allocation bytes 0 B
    [ALLOC_TYPETREE_THREAD]
      Peak usage frame count: [16.0 KB-32.0 KB]: 390 frames
      Requested Block Size 2.0 MB
      Peak Block count 1
      Peak Allocated memory 22.9 KB
      Peak Large allocation bytes 0 B

Well my next thought is that it is stuck in an infinite loop in SpawnPoint.GetRandomSpawnPoint().

Since the code never gets to the next line and doesn’t throw an error.

I’ll poke around in there. Since it works fine for the other pathway, I’m concerned it’s more insidious. I’m still chugging along with the (excellent) course using the automatic spawn workflow.

If I discover anything, I’ll be sure to post a follow up.

1 Like

Privacy & Terms