Version: 2019.3

EditorUtility.CopySerializedManagedFieldsOnly

マニュアルに切り替える
public static void CopySerializedManagedFieldsOnly (object source, object dest);

パラメーター

sourceThe object to copy data from.
destThe object to copy data to.

説明

Copies the serializable fields from one managed object to another.

This is similar to CopySerialized, but you can use it with any two managed objects, rather than two instances of the same Object subclass.

CopyScriptManagedFieldsOnly copies all fields supported by the Unity serializer. If the destination object is not of the same class as the source object, then the function matches fields by name, or by using the FormerlySerializedAs attribute. The function does not modify any fields on the destination object which are not serializable, or which do not have corresponding fields in the source object.

If the source object implements the ISerializationCallbackReceiver interface, then its OnBeforeSerialize method is called before any data is read. Similarly, if the destination object implements the ISerializationCallbackReceiver, then its OnAfterDeserialize method is called after data has been copied into its fields.

CopyScriptManagedFieldsOnly only copies fields defined in managed code. This means that if you attempt to copy engine objects such as Transform or Light, CopyScriptManagedFieldsOnly does not copy any data, since all of their serializable fields are defined in native code.

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961