using System; using MLAPI.Logging; using UnityEngine; namespace MLAPI.Configuration { /// /// A class that represents a NetworkPrefab /// [Serializable] public class NetworkPrefab { internal ulong Hash { get { if (Prefab == null) { if (NetworkLog.CurrentLogLevel <= LogLevel.Normal) { NetworkLog.LogWarning($"{nameof(NetworkPrefab)} is not assigned"); } return 0; } var networkObject = Prefab.GetComponent(); if (networkObject == null) { if (NetworkLog.CurrentLogLevel <= LogLevel.Normal) { NetworkLog.LogWarning($"{nameof(NetworkPrefab)} {Prefab.name} does not have a {nameof(NetworkObject)}"); } return 0; } return networkObject.PrefabHash; } } /// /// The gameobject of the prefab /// public GameObject Prefab; /// /// Whether or not this is a playerPrefab /// public bool PlayerPrefab; } }