You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
611 B
C#
25 lines
611 B
C#
using Fusion;
|
|
using UnityEngine;
|
|
|
|
[RequireComponent(typeof(NetworkObject))]
|
|
public class PlayerCameraSetup : NetworkBehaviour
|
|
{
|
|
[Tooltip("Drag your MainCamera child here")]
|
|
[SerializeField] Camera playerCamera;
|
|
|
|
[Tooltip("If you have an AudioListener on that camera")]
|
|
[SerializeField] AudioListener audioListener;
|
|
|
|
public override void Spawned()
|
|
{
|
|
base.Spawned();
|
|
|
|
bool isMine = Object.HasInputAuthority;
|
|
|
|
if (playerCamera != null)
|
|
playerCamera.enabled = isMine;
|
|
if (audioListener != null)
|
|
audioListener.enabled = isMine;
|
|
}
|
|
}
|