BITKit/Src/Unity/Scripts/Entity/Core/EntityIdComponent.cs

20 lines
389 B
C#
Raw Normal View History

2023-08-11 23:57:37 +08:00
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace BITKit.Entities
{
public class EntityIdComponent : EntityComponent
{
public ulong Id;
public string Name;
public override void Initialize(IEntity _entity)
{
if (Id is 0) Id = (ulong)Guid.NewGuid().GetHashCode();
base.Initialize(_entity);
_entity.Set(this);
}
}
}