您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

46 行
1.1 KiB

using System;
using UnityEngine;
namespace UnityEditor.ShaderGraph
{
[Serializable]
public class SerializableCubemap : ISerializationCallbackReceiver
{
[SerializeField]
private string m_SerializedCubemap;
[Serializable]
private class CubemapHelper
{
public Cubemap cubemap;
}
Cubemap m_Cubemap;
public Cubemap cubemap
{
get
{
if (m_Cubemap == null && !string.IsNullOrEmpty(m_SerializedCubemap))
{
var cube = new CubemapHelper();
EditorJsonUtility.FromJsonOverwrite(m_SerializedCubemap, cube);
m_Cubemap = cube.cubemap;
m_SerializedCubemap = null;
}
return m_Cubemap;
}
set { m_Cubemap = value; }
}
public void OnBeforeSerialize()
{
var cube = new CubemapHelper { cubemap = cubemap };
m_SerializedCubemap = EditorJsonUtility.ToJson(cube, true);
}
public void OnAfterDeserialize()
{
}
}
}