/** * Add a diff entry for a component. `component` points to the edited component, name is the variable name, and * value is the new value. */ public static void AddDiff(Component component, string name, object value) { GameObject go = component.gameObject; pb_MetaDataComponent md_component = go.GetComponent <pb_MetaDataComponent>(); if (md_component == null) { md_component = go.AddComponent <pb_MetaDataComponent>(); } pb_ComponentDiff diff = md_component.metadata.componentDiff; if (diff.modifiedValues.TryGetValue(component, out Dictionary <string, object> v)) { if (v.ContainsKey(name)) { v[name] = value; } else { v.Add(name, value); } } else { diff.modifiedValues.Add(component, new Dictionary <string, object>() { { name, value } }); } }
/** * Serialized constructor. */ public pb_MetaData(SerializationInfo info, StreamingContext context) { _fileId = (string) info.GetValue("_fileId", typeof(string)); _assetBundlePath = (pb_AssetBundlePath) info.GetValue("_assetBundlePath", typeof(pb_AssetBundlePath)); _assetType = (AssetType) info.GetValue("_assetType", typeof(AssetType)); componentDiff = (pb_ComponentDiff) info.GetValue( "componentDiff", typeof(pb_ComponentDiff)); }
/** * Basic constructor (used on instance assets). */ public pb_MetaData() { _assetType = AssetType.Instance; _fileId = GUID_NOT_FOUND; _assetBundlePath = null; componentDiff = new pb_ComponentDiff(); }
void OnEnable() { data = (pb_MetaDataComponent) target; diff = data.metadata.componentDiff; }