Transferring Ownership to Move an Object from the Client Side in Unity Netcode

Hi everyone,

I’m working on a Unity project using Netcode. I’ve spawned an object on the server and I need to move it from the client side. Currently, I’m using RPC calls on the server to update the position, but the results are not satisfactory due to latency and synchronization issues.

I’ve tried using the ChangeOwnership method to transfer ownership of the object to the client, but I can’t move the object from the client side.

My question is: Is it possible to transfer ownership of a spawned object to the client so that I can move it directly from the client side without passing the updated position through the server? If so, what is the correct approach to achieve this ?

Update: you need to add this script in your object :

using UnityEngine;
using Unity.Netcode.Components;

public class NetworkTransformClient : NetworkTransform
{
    protected override bool OnIsServerAuthoritative()
    {
        return false;
    }
}