slowpoker/Assets/Scripts/Network/ComponentsSync.cs

34 lines
755 B
C#
Raw Permalink Normal View History

2024-10-17 23:09:51 +03:00
using System.Collections.Generic;
using UnityEngine;
using Mirror;
public class ComponentsSync : NetworkBehaviour
{
public List<GameObject> objects;
public List<MonoBehaviour> scripts;
public List<SkinnedMeshRenderer> models;
void Start()
{
if (!isLocalPlayer)
{
foreach (var gameObject in objects)
{
gameObject.SetActive(false);
}
foreach (var script in scripts)
{
script.enabled = false;
}
}
else
{
foreach (var model in models)
{
model.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.ShadowsOnly;
}
}
}
}