您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
40 行
950 B
40 行
950 B
using System;
|
|
using UnityEngine;
|
|
|
|
namespace UnityEditor.ShaderGraph
|
|
{
|
|
[Serializable]
|
|
public class SerializableTexture
|
|
{
|
|
[SerializeField]
|
|
private string m_SerializedTexture;
|
|
|
|
[Serializable]
|
|
private class TextureHelper
|
|
{
|
|
public Texture texture;
|
|
}
|
|
|
|
public Texture texture
|
|
{
|
|
get
|
|
{
|
|
if (string.IsNullOrEmpty(m_SerializedTexture))
|
|
return null;
|
|
|
|
var tex = new TextureHelper();
|
|
EditorJsonUtility.FromJsonOverwrite(m_SerializedTexture, tex);
|
|
return tex.texture;
|
|
}
|
|
set
|
|
{
|
|
if (texture == value)
|
|
return;
|
|
|
|
var tex = new TextureHelper();
|
|
tex.texture = value;
|
|
m_SerializedTexture = EditorJsonUtility.ToJson(tex, true);
|
|
}
|
|
}
|
|
}
|
|
}
|