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.

28 lines
647 B
C#

using System;
using UnityEngine;
namespace Unity.BossRoom.Infrastructure
{
/// <summary>
/// ScriptableObject that stores a GUID for unique identification. The population of this field is implemented
/// inside an Editor script.
/// </summary>
[Serializable]
public abstract class GuidScriptableObject : ScriptableObject
{
[HideInInspector]
[SerializeField]
byte[] m_Guid;
public Guid Guid => new Guid(m_Guid);
void OnValidate()
{
if (m_Guid.Length == 0)
{
m_Guid = Guid.NewGuid().ToByteArray();
}
}
}
}