您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
39 行
979 B
39 行
979 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 textureHelper = new TextureHelper();
|
|
textureHelper.texture = value;
|
|
m_SerializedTexture = EditorJsonUtility.ToJson(textureHelper, true);
|
|
}
|
|
}
|
|
}
|
|
}
|