Ejemplo n.º 1
0
 public static void GatherSerializedObjectCacheEntries(this WriteCommand command, HashSet <CacheEntry> cacheEntries)
 {
     if (command.serializeObjects != null)
     {
         var objectIds = command.serializeObjects.Select(x => x.serializationObject);
         var types     = BuildCacheUtility.GetTypeForObjects(objectIds);
         cacheEntries.UnionWith(types.Select(BuildCacheUtility.GetCacheEntry));
         cacheEntries.UnionWith(objectIds.Select(BuildCacheUtility.GetCacheEntry));
     }
 }
Ejemplo n.º 2
0
        static List <ObjectIdentifier> GetSortedSceneObjectIdentifiers(List <ObjectIdentifier> objects)
        {
            var types         = new List <Type>(BuildCacheUtility.GetTypeForObjects(objects));
            var sortedObjects = new List <SortObject>();

            for (int i = 0; i < objects.Count; i++)
            {
                sortedObjects.Add(new SortObject {
                    sortIndex = GetSortIndex(types[i]), objectId = objects[i]
                });
            }
            return(sortedObjects.OrderBy(x => x.sortIndex).Select(x => x.objectId).ToList());
        }
Ejemplo n.º 3
0
        /// <inheritdoc />
        public ReturnCode Run()
        {
            HashSet <ObjectIdentifier> buildInObjects = new HashSet <ObjectIdentifier>();

            foreach (AssetLoadInfo dependencyInfo in m_DependencyData.AssetInfo.Values)
            {
                buildInObjects.UnionWith(dependencyInfo.referencedObjects.Where(x => x.guid == k_BuiltInGuid));
            }

            foreach (SceneDependencyInfo dependencyInfo in m_DependencyData.SceneInfo.Values)
            {
                buildInObjects.UnionWith(dependencyInfo.referencedObjects.Where(x => x.guid == k_BuiltInGuid));
            }

            ObjectIdentifier[] usedSet   = buildInObjects.ToArray();
            Type[]             usedTypes = BuildCacheUtility.GetTypeForObjects(usedSet);

            if (m_Layout == null)
            {
                m_Layout = new BundleExplictObjectLayout();
            }

            Type shader = typeof(Shader);

            for (int i = 0; i < usedTypes.Length; i++)
            {
                if (usedTypes[i] != shader)
                {
                    continue;
                }

                m_Layout.ExplicitObjectLocation.Add(usedSet[i], ShaderBundleName);
            }

            if (m_Layout.ExplicitObjectLocation.Count == 0)
            {
                m_Layout = null;
            }

            return(ReturnCode.Success);
        }
 /// <summary>
 /// Returns the Object Identifiers and Types in a raw Unity Serialized File. The resulting arrays will be empty if a non-serialized file path was used.
 /// </summary>
 /// <param name="path">Path to the Unity Serialized File</param>
 /// <param name="objectIdentifiers">Object Identifiers for all the objects in the serialized file</param>
 /// <param name="types">Types for all the objects in the serialized file</param>
 public void GetObjectIdentifiersAndTypesForSerializedFile(string path, out ObjectIdentifier[] objectIdentifiers, out Type[] types)
 {
     objectIdentifiers = ContentBuildInterface.GetPlayerObjectIdentifiersInSerializedFile(path, m_Parameters.Target);
     types             = BuildCacheUtility.GetTypeForObjects(objectIdentifiers);
 }