24 lines
491 B
C#
24 lines
491 B
C#
using System;
|
|
using Unity.Collections;
|
|
using UnityEngine;
|
|
|
|
namespace Code.Example.Platformer.Entity
|
|
{
|
|
public class EntityGUID : MonoBehaviour
|
|
{
|
|
[SerializeField, ReadOnly] private string _id = GenerateId();
|
|
|
|
public string Id => _id;
|
|
|
|
[ContextMenu("Reset Id")]
|
|
private void ResetId()
|
|
{
|
|
_id = GenerateId();
|
|
}
|
|
|
|
private static string GenerateId()
|
|
{
|
|
return Guid.NewGuid().ToString();
|
|
}
|
|
}
|
|
} |