示例#1
0
 public void AddUnityReference(UnityReference reference)
 {
     if (unityReferences != null)
     {
         unityReferences.Add(reference);
     }
 }
示例#2
0
            private void SetValue(Scene scene, object value, Action <object> set_callback)
            {
                if (value != null && value is UnityReference)
                {
                    UnityReference reference = value as UnityReference;

                    reference.UnitySetCallback = set_callback;

                    scene.AddUnityReference(reference);
                }
                else
                {
                    set_callback(value);
                }
            }
示例#3
0
        public static UnityReference FromUnity(Scene scene, UnityEngine.Object v)
        {
            UnityReference reference = null;

            if (v != null)
            {
                reference = new UnityReference();

                reference.type       = v.GetType();
                reference.id         = (uint)v.GetInstanceID();
                reference.unityValue = v;

                scene.AddUnityReference(reference);
            }

            return(reference);
        }
示例#4
0
            private static void AddValue(Scene scene, Dictionary <string, object> dictionnary, System.Type component_type, System.Type type, string name, object value)
            {
                if (value != null)
                {
                    if (value is UnityEngine.Object)
                    {
                        dictionnary.Add(name, UnityReference.FromUnity(scene, value as UnityEngine.Object));
                    }
                    else
                    {
                        try
                        {
                            Binary.GetSupportedType(type);

                            dictionnary.Add(name, value);
                        }
                        catch (ArgumentException)
                        {
                            Debug.LogWarningFormat("Unsupported value '{0}' of type '{1}' in component of type '{2}'. Value will not be serialized.", name, type, component_type);
                        }
                    }
                }
            }