using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace TFramework
{
[Serializable]
public class Behaviour : MonoBehaviour
{
[SerializeField, HideInInspector]
private string m_id;
public string ID{
get => m_id = string.IsNullOrEmpty(m_id) ? gameObject.name + "_" + long.Parse(DateTime.Now.ToString("yyyyMMddhhmmss")).ToString("X") : m_id;
protected set => m_id = value;
}
public virtual void Start()
{
}
///
/// 重置ID
///
public void ResetID()=> ID = gameObject.name + "_" + long.Parse(DateTime.Now.ToString("yyyyMMddhhmmss")).ToString("X");
///
/// 复制
///
public void CopyButtonEvent() => GUIUtility.systemCopyBuffer = ID;
#region 通用
///
/// 获取子物体
///
///
///
public Transform GetChild(int index) => transform.childCount > 0 ? transform.GetChild(index) : null;
///
/// 获取gameObject名字
///
public string ObjName
{
get => gameObject.name;
set => gameObject.name = value;
}
#endregion
}
}