Converted everything to Meta XR All in One to make Eye-Tracking work again
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
using Unity.Netcode;
|
||||
using UnityEngine;
|
||||
|
||||
public class LocalOnly : NetworkBehaviour
|
||||
{
|
||||
public Behaviour[] componentsToDisable;
|
||||
public GameObject[] objectsToDisable;
|
||||
public GameObject[] objectsToTag;
|
||||
|
||||
public override void OnNetworkSpawn()
|
||||
{
|
||||
if (!IsOwner)
|
||||
{
|
||||
|
||||
foreach (var comp in componentsToDisable)
|
||||
{
|
||||
if (comp != null) comp.enabled = false;
|
||||
}
|
||||
|
||||
foreach (var obj in objectsToDisable)
|
||||
{
|
||||
if (obj != null) obj.SetActive(false);
|
||||
}
|
||||
|
||||
foreach(var obj in objectsToTag)
|
||||
{
|
||||
if (obj != null)
|
||||
{
|
||||
obj.tag = "RemotePlayer";
|
||||
obj.layer = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Kamera-Tags sicherstellen
|
||||
Camera cam = GetComponentInChildren<Camera>();
|
||||
if (cam != null && cam.CompareTag("MainCamera"))
|
||||
cam.enabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Nur der lokale Spieler darf "MainCamera" haben
|
||||
Camera cam = GetComponentInChildren<Camera>();
|
||||
if (cam != null)
|
||||
cam.tag = "MainCamera";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user