Questions Regarding MLAPI Code

using MLAPI;
using MLAPI.Messaging;
using MLAPI.NetworkVariable;
using UnityEngine;

namespace HelloWorld
{
    public class HelloWorldPlayer : NetworkBehaviour
    {
        public NetworkVariableVector3 Position = new NetworkVariableVector3(new NetworkVariableSettings
        {
            WritePermission = NetworkVariablePermission.ServerOnly,
            ReadPermission = NetworkVariablePermission.Everyone
        });

        public override void NetworkStart()
        {
            Move();
        }

        public void Move()
        {
            if (NetworkManager.Singleton.IsServer)
            {
                var randomPosition = GetRandomPositionOnPlane();
                transform.position = randomPosition;
                Position.Value = randomPosition;
            }
            else
            {
                SubmitPositionRequestServerRpc();
            }
        }

        [ServerRpc]
        void SubmitPositionRequestServerRpc(ServerRpcParams rpcParams = default)
        {
            Position.Value = GetRandomPositionOnPlane();
        }

        static Vector3 GetRandomPositionOnPlane()
        {
            return new Vector3(Random.Range(-3f, 3f), 1f, Random.Range(-3f, 3f));
        }

        void Update()
        {
            transform.position = Position.Value;
        }
    }
}

I am quite new to Unity and recently just started using MLAPI. Can I know why do we need to put (ServerRpcParams rpcParams = default)? What function does it have? And what happens if we dont put it in? I read the documentation but my understanding of it is still cloudy at best

      [ServerRpc]
        void SubmitPositionRequestServerRpc(ServerRpcParams rpcParams = default)
        {
            Position.Value = GetRandomPositionOnPlane();
        }

Any help is greatly appreciated!

There is no need to include ServerRpcParams if you don’t use it. One use case of the ServerRpcParams is to get access to the sender client of the RPC (rpcParams.Receive.SenderClientId`.

Thanks for the explanation luke. Also if you dont mind, can you also give an example on a time where we would need to get access to the sender client of the RPC?

And also, for this section for the code,

public override void NetworkStart()
        {
            Move();
        }

is it really neccessary to override? And what are we overriding?

NetworkStart gets called whenever a NetworkObject gets spawned. The base function is just empty so you are not overriding any existing behavior. You can think of it as something like Awake or Start it just uses a different syntax.

For instance if you have an object in the scene with which any player can interact with. Let’s say a button which they can press and if they do so a text changes to their name. probably not the best example but whatever :smile:. In that case you could use a ServerRPC to send that button press up and you would use the owner id to figure out which player pressed.