PO/Library/PackageCache/com.unity.2d.animation@5.0.7/Editor/SkinningModule/Cache/CacheObject.cs

40 lines
1006 B
C#
Raw Normal View History

2022-01-12 10:06:03 +03:00
using System;
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;
return cacheObject;
}
[SerializeField]
private 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() {}
}
}