#Client controls all player cameras

1 messages · Page 1 of 1 (latest)

red edge
#

Hello, I'm new to netcode for game objects and I'm trying to learn how to use it. I ran into a problem though, where the client controls the camera movement of itself AND it controls the one on the host but only on the y-axis. The host has no control over the cameras.
Code:

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

public class PlayerLook : NetworkBehaviour
{
    [SerializeField] Transform cam;

    [Header("Stats")]
    [SerializeField] float camSens;

    void Update()
    {
        if (!IsOwner)
        {
            return;
        }

        //Move cam
        cam.rotation = Quaternion.Euler(cam.eulerAngles.x - Input.GetAxisRaw("Mouse Y") * camSens * Time.deltaTime * 100, transform.eulerAngles.y, 0);

        if (cam.transform.eulerAngles.x < 275 && cam.transform.eulerAngles.x > 95)
        {
            cam.transform.eulerAngles = new Vector3(275, transform.eulerAngles.y, transform.eulerAngles.z);
        }
        else if (cam.transform.eulerAngles.x > 85 && cam.transform.eulerAngles.x < 270)
        {
            cam.transform.eulerAngles = new Vector3(85, transform.eulerAngles.y, transform.eulerAngles.z);
        }

        transform.rotation = Quaternion.Euler(0, transform.eulerAngles.y + Input.GetAxisRaw("Mouse X") * camSens * Time.deltaTime * 100, 0);
    }
}
snow elbow
#

Hi

#

I am actually here to know something...Did you have to enter your Payment info to use it or not

#

I mean Netcode

red edge
#

No

#

But I never heard that netcode costs money

#

I just installed the package

snow elbow
#

Oh

#

As much I have heard, Netcode requires setup in your dashboard

red edge
#

What dashboard?

snow elbow
#

Unity dashboard

red edge
#

But that's not the netcode for gameobjects is it?

#

The documentation doesn't say I need to pay for it

#

Oh I think i know what the issue is