Exemplo n.º 1
0
        protected override object WriteToImpl(object obj)
        {
            RuntimeBinaryAsset bin = (RuntimeBinaryAsset)base.WriteToImpl(obj);

            bin.Data = Data;
            bin.Ext  = Ext;
            return(bin);
        }
Exemplo n.º 2
0
        protected override void ReadFromImpl(object obj)
        {
            base.ReadFromImpl(obj);

            RuntimeBinaryAsset bin = (RuntimeBinaryAsset)obj;

            Data = bin.Data;
            Ext  = bin.Ext;
        }
Exemplo n.º 3
0
        private IEnumerator CoSaveAssembly(byte[] binData, ProjectAsyncOperation ao)
        {
            RuntimeBinaryAsset asmBinaryData = ScriptableObject.CreateInstance <RuntimeBinaryAsset>();

            asmBinaryData.Data = binData;

            ProjectAsyncOperation setValueAo = m_project.SetValue(RuntimeAssemblyKey, asmBinaryData);

            yield return(setValueAo);

            if (setValueAo.HasError)
            {
                RaiseCompiled(false);

                ao.Error       = setValueAo.Error;
                ao.IsCompleted = true;
                yield break;
            }

            LoadAssembly(binData);

            RuntimeTypeGuids guids = new RuntimeTypeGuids
            {
                Guids = m_typeNameToGuid.Select(kvp => new RuntimeTypeGuid {
                    FullName = kvp.Key, Guid = kvp.Value.ToString()
                }).ToArray()
            };

            m_runtimeTypeGuidsAsset.Text = XmlUtility.ToXml(guids);
            ProjectAsyncOperation setGuidsAo = m_project.SetValue(RuntimeTypeGuids, m_runtimeTypeGuidsAsset);

            yield return(setGuidsAo);

            if (setGuidsAo.HasError)
            {
                RaiseCompiled(false);

                Debug.LogError(setGuidsAo.Error);
                ao.Error = setGuidsAo.Error;
            }
            else
            {
                RaiseCompiled(true);

                ao.Error = Error.NoError;
            }
            ao.IsCompleted = true;
        }