示例#1
0
        public void iLoad(Serialization.SerializationInfoWrapper info)
        {
            // unpack data, remove undeclared components
            var typeList = info.GetValue <List <ComponentData> >("componentList");

            foreach (var componentData in typeList)
            {
                var type = Type.GetType(componentData.m_Type);

                if (type == null)
                {
                    continue;
                }

                var component = gameObject.GetComponent(type);
                if (component == null)
                {
                    component = gameObject.AddComponent(type);
                }

                foreach (var field in componentData.m_FieldDictionary)
                {
                    type.GetField(field.Key, BindingFlags.Public | BindingFlags.Instance).SetValue(component, field.Value);
                }
            }
        }
 public void iLoad(Serialization.SerializationInfoWrapper info)
 {
     gameObject.transform.localPosition = info.GetValue <Vector3>(c_KeyPosition);
     gameObject.transform.localRotation = info.GetValue <Quaternion>(c_KeyRotation);
     gameObject.transform.localScale    = info.GetValue <Vector3>(c_KeyScale);
 }