Singularity/Library/PackageCache/com.unity.2d.animation@7.0.10/Editor/SkinningModule/Cache/CacheObject.cs
2024-05-06 11:45:45 -07:00

40 lines
1.0 KiB
C#

using UnityEngine;
namespace UnityEditor.U2D.Animation
{
internal class CacheObject : BaseObject, ISerializationCallbackReceiver
{
public static T Create<T>(Cache owner) where T : CacheObject
{
var cacheObject = CreateInstance<T>();
cacheObject.hideFlags = HideFlags.HideAndDontSave;
cacheObject.owner = owner;
cacheObject.name = cacheObject.GetType().ToString();
return cacheObject;
}
[SerializeField]
Cache m_Owner;
public Cache owner
{
get { return m_Owner; }
set { m_Owner = value; }
}
void ISerializationCallbackReceiver.OnAfterDeserialize()
{
OnAfterDeserialize();
}
void ISerializationCallbackReceiver.OnBeforeSerialize()
{
OnBeforeSerialize();
}
internal virtual void OnCreate() {}
protected virtual void OnAfterDeserialize() {}
protected virtual void OnBeforeSerialize() {}
}
}