Unity Netcode ServerRpc not being called

303 Views Asked by At

I'm using Unity's Netcode for GameObjects, and I can't see a reason why this isn't working. I use Rpcs in the rest of my project, but this doesn't seem any different from that. Any help would be appreciated!

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Unity.Netcode;

public class TestOnline : NetworkBehaviour
{

    public override void OnNetworkSpawn()
    {
        TestServerRpc();
    }

    void Update()
    {
        
    }

    [ServerRpc(RequireOwnership = false)]
    void TestServerRpc()
    {
        Debug.Log("This isn't being printed");
    }
}

This code should cause the host of the lobby to print in the log when the scene is loaded.

0

There are 0 best solutions below