Inheritance: ISerializable
Example #1
0
        /**
         * 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 }
                });
            }
        }
Example #2
0
		/**
		 * 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));
		}
Example #3
0
		/**
		 * Basic constructor (used on instance assets).
		 */
		public pb_MetaData()
		{
			_assetType = AssetType.Instance;
			_fileId = GUID_NOT_FOUND;
			_assetBundlePath = null;

			componentDiff = new pb_ComponentDiff();
		}
Example #4
0
		void OnEnable()
		{
			data = (pb_MetaDataComponent) target;
			diff = data.metadata.componentDiff;
		}