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