您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
43 行
904 B
43 行
904 B
using System;
|
|
using UnityEngine;
|
|
|
|
namespace UnityEditor.ShaderGraph
|
|
{
|
|
[Serializable]
|
|
class SerializableGuid : ISerializationCallbackReceiver
|
|
{
|
|
public SerializableGuid()
|
|
{
|
|
m_Guid = Guid.NewGuid();
|
|
}
|
|
|
|
public SerializableGuid(Guid guid)
|
|
{
|
|
m_Guid = guid;
|
|
}
|
|
|
|
[NonSerialized]
|
|
private Guid m_Guid;
|
|
|
|
[SerializeField]
|
|
private string m_GuidSerialized;
|
|
|
|
public Guid guid
|
|
{
|
|
get { return m_Guid; }
|
|
}
|
|
|
|
public virtual void OnBeforeSerialize()
|
|
{
|
|
m_GuidSerialized = m_Guid.ToString();
|
|
}
|
|
|
|
public virtual void OnAfterDeserialize()
|
|
{
|
|
if (!string.IsNullOrEmpty(m_GuidSerialized))
|
|
m_Guid = new Guid(m_GuidSerialized);
|
|
else
|
|
m_Guid = Guid.NewGuid();
|
|
}
|
|
}
|
|
}
|