Ejemplo n.º 1
0
        internal object DropObject(DropEvents dropEvent)
        {
            this.dropEvent      = dropEvent;
            this.WillDrop       = true;
            this.IsBeingClaimed = dropEvent != DropEvents.None && dropEvent != DropEvents.Canceled;

            if (this.lastSeenEvent == EventType.Repaint)
            {
                this.FinalizeDropObject();
            }

            if (dropEvent == DropEvents.Copied)
            {
                if (this.Object.GetType().InheritsFrom(typeof(UnityEngine.Object)))
                {
                    return(this.Object);
                }

                using (var stream = new MemoryStream())
                {
                    List <UnityEngine.Object> unityReferences;
                    SerializationUtility.SerializeValue(this.Object, stream, DataFormat.Binary, out unityReferences);
                    stream.Position = 0;
                    return(SerializationUtility.DeserializeValue <object>(stream, DataFormat.Binary, unityReferences));
                }
            }

            return(this.Object);
        }
Ejemplo n.º 2
0
 void Awake()
 {
     current = this;
 }