示例#1
0
        public SerializableGameObject(GameObject obj) : base(obj)
        {
            _activeSelf      = obj.activeSelf;
            _layer           = obj.layer;
            _isStatic        = obj.isStatic;
            _tag             = obj.tag;
            _folderName      = Utility.GetGameObjectFolderName(obj);
            _fileName        = string.Format(@"""{0}""", obj.name);
            _isRectTransform = obj.GetComponent <RectTransform>() != null;

            _components = new List <Reference>();
            foreach (Component comp in obj.GetComponents <Component>())
            {
                if (comp == null)
                {
                    continue;
                }

                Debugging.Info("Serializing component " + comp + " of " + obj);

                _components.Add(Reference.Create(comp));
            }

            _children = new List <Reference>();
            foreach (Transform child in obj.transform)
            {
                Debugging.Info("Serializing child " + child + " of " + obj);

                _children.Add(Reference.Create(child.gameObject));
            }
        }
示例#2
0
        private static void CheckForCachedActions()
        {
            foreach (KeyValuePair <int, List <ActionInstance> > queueObject in _deserializedObjectQueue.Union(_serializedObjectQueue))
            {
                if (_objectReferences.ContainsKey(queueObject.Key))
                {
                    ObjectEntry entry = _objectReferences[queueObject.Key];

                    if (_serializedObjectQueue.ContainsKey(queueObject.Key))
                    {
                        if (entry.SerializedObject != null)
                        {
                            Debugging.Info("Executing serialized object queue for object " + entry.ID);

                            ExecuteActions(_serializedObjectQueue[entry.ID], entry.SerializedObject);
                        }
                        else
                        {
                            Debugging.Warning("Serialized object for " + entry.ID + " has not been added");
                        }
                    }
                    if (_deserializedObjectQueue.ContainsKey(queueObject.Key))
                    {
                        if (entry.DeserializedObject != null)
                        {
                            Debugging.Info("Executing deserialized object queue for object " + entry.ID);

                            ExecuteActions(_deserializedObjectQueue[entry.ID], entry.DeserializedObject);
                        }
                        else
                        {
                            Debugging.Warning("Deserialized object for " + entry.ID + " has not been added");
                        }
                    }
                }
                else
                {
                    Debugging.Warning("ID " + queueObject.Key + " has not been deserialized. Objects waiting for execution: " + queueObject.Value);
                }
            }
        }