Files
obsidian-notes/SerializedObject.md
2022-10-22 03:01:04 +08:00

30 lines
1.1 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

### [[Unity编辑器扩展基础总结] 第5章 序列化对象 SerializedObject](链接)
#### 第5章 序列化对象 SerializedObject
###### https://www.cnblogs.com/ppne/p/14752941.html
### 笔记
#### SerializedObject:
##### 作用:
资源文件的序列化和反序列化
可以链接一个数组,多个对象使用同一个SerializedObject
##### 运行:
继承Mono,ScriptableObject,Editor,EditorWindow
会为对象生成SerializedObject,生成对象会在内部缓存
所以如果两个不同位置使用同一个对象,应使用Update更新对象,使用ApplyModifiedPropertiyin应用这个对象的更改
创建资源时,会先创建SerializedOject, 这个对象再创建Object和.meta
#### Object
资源文件,一般为二进制或者yaml文件,记录文件序列化信息
#### .meta
记录文件导入相关信息
我们也可以使用UnityEditorInternal命名空间中的**InternalEditorUtility.SaveToSerializedFileAndForget**将UnityEngine.Object另存为资源。
#### Q
AssetDataBase.Load()到底是序列化作用还是从内存中找到GameObject对应的SerializedObject
反射命中对象到底是SerializedObject还是GameObject