Beispiel #1
0
        /// <summary>
        /// Right now this only works if the asset or one of its parents (referencers) are in a packaged scene or in a resources folder.
        /// If the asset is just in a bundle this is currently not tracked. Trying to find a solution for this.
        /// </summary>
        public static bool IsNodePackedToApp(string id, string type, NodeDependencyLookupContext stateContext,
                                             HashSet <string> visitedKeys)
        {
            if (visitedKeys.Contains(id))
            {
                return(false);
            }

            visitedKeys.Add(id);

            Node node = stateContext.RelationsLookup.GetNode(id, type);

            if (node == null)
            {
                return(false);
            }

            foreach (KeyValuePair <string, INodeHandler> pair in stateContext.NodeHandlerLookup)
            {
                INodeHandler nodeHandler = pair.Value;

                if (nodeHandler.GetHandledNodeTypes().Contains(type) && nodeHandler.IsNodePackedToApp(id, type))
                {
                    return(true);
                }
            }

            foreach (Connection connection in node.Referencers)
            {
                Node refNode = connection.Node;

                if (!stateContext.ConnectionTypeLookup.GetDependencyType(connection.Type).IsIndirect&&
                    IsNodePackedToApp(refNode.Id, refNode.Type, stateContext, visitedKeys))
                {
                    return(true);
                }
            }

            return(false);
        }