mirror of
https://github.com/Cardidi/ca2d-unity-toolkit.git
synced 2025-12-20 01:06:03 +08:00
21 lines
489 B
C#
21 lines
489 B
C#
using System;
|
|
using UnityEngine;
|
|
using Object = UnityEngine.Object;
|
|
|
|
namespace Ca2d.Toolkit
|
|
{
|
|
[Serializable]
|
|
public struct UnityObjectWarp<T> where T : class
|
|
{
|
|
[SerializeField] private Object m_referencedObject;
|
|
|
|
public bool Valid => m_referencedObject is T;
|
|
|
|
public T Object => m_referencedObject as T;
|
|
|
|
public static implicit operator T(UnityObjectWarp<T> wrapper)
|
|
{
|
|
return wrapper.Object;
|
|
}
|
|
}
|
|
} |