c# 与 Unity3d 中的序列化
2016-02-17 09:42
531 查看
圣典中对于Unity3D的序列化介绍很容易和C#的序列化介绍搞混,做个笔记,方便以后查找。
很多资料算是拾人牙慧.
Inherits from Attribute
The Serializable attribute lets you embed a class with sub properties in the inspector.
Serializable(序列化)属性让你植入一个类用替代内容在Inspector(检视面板)
You can use this to display variables in the inspector similar to how a Vector3 shows
up in the inspector. The name and a triangle to expand its properties. To do this you need create a class that derives from System.Object and give it the Serializable attribute. In JavaScript the Serializable attribute is implicit and not necessary.
你可以用这个去显示变量在inspector(检视面板)类似于将一个Vector3(3维向量)显示在inspector(检视面板)。这个名字和一个三角来扩展他的内容。去做这个你需要创建一个起源于System.Object的类并且给他Serializable属性。在JavaScript这个Serializable属性是隐含的,不必要的。
You Can Do Like that:
本质上不过就是用一个类来代替一些字段让编辑器编辑罢了
很多资料算是拾人牙慧.
一、Serializable 序列化
Inherits from AttributeThe Serializable attribute lets you embed a class with sub properties in the inspector.
Serializable(序列化)属性让你植入一个类用替代内容在Inspector(检视面板)
You can use this to display variables in the inspector similar to how a Vector3 shows
up in the inspector. The name and a triangle to expand its properties. To do this you need create a class that derives from System.Object and give it the Serializable attribute. In JavaScript the Serializable attribute is implicit and not necessary.
你可以用这个去显示变量在inspector(检视面板)类似于将一个Vector3(3维向量)显示在inspector(检视面板)。这个名字和一个三角来扩展他的内容。去做这个你需要创建一个起源于System.Object的类并且给他Serializable属性。在JavaScript这个Serializable属性是隐含的,不必要的。
class Test extends System.Object { var p = 5; var c = Color.white; } var test = Test ();
// C# Example [System.Serializable] class Test { public int p = 5; public Color c = Color.white; }
You Can Do Like that:
本质上不过就是用一个类来代替一些字段让编辑器编辑罢了
相关文章推荐
- 结构体(Unity3D C#)
- 【Unity】是否进入摄像机显示区域。
- Unity中关于单位像素与单位长度的关系
- 构建ASP.NET MVC5+EF6+EasyUI 1.4.3+Unity4.x注入的后台管理系统--工作流演示截图
- [Unity2d系列教程] 003.Unity如何调用android的方法
- C#的null与Unity3d
- Unity使用FXMaker导致发布时报“The type or namespace name `UnityEditor' could not be found” 解决备忘
- Unity3d NGUI的使用_UIScrollView制作滑动列表
- 【Unity】Unity中的枚举和标志
- unity扩展MonoBehaviour
- unity3d 打包apk
- Unity 使用LineRenderer 画箭头
- Unity Shader 学习笔记(十四)使用屏幕特效实现亮度饱和度和对比度
- 【Unity3D】 Unity3D中自带事件函数的执行顺序
- 【Unity】unity 枚举分隔符
- Unity3D 封装自己的Debug类库dll
- 开始写博客啦!!
- unity3d 导出NGUI图集中的图片
- DrawCall的简单介绍
- 【Unity插件】NGUI核心组件之UICamera