Only download packages from the current project when opening in the Editor (#3619)

- Only download packages from the current project when opening in the editor
- Make sure to download packages referenced within any libraries in the current project
This commit is contained in:
Carson Kompon
2025-12-17 09:59:28 -05:00
committed by GitHub
parent 1b9ac54a83
commit 57b5efb655
2 changed files with 22 additions and 3 deletions

View File

@@ -324,7 +324,7 @@ static class StartupLoadProject
{
var sw = Stopwatch.StartNew();
packagesToDownload.AddRange( CloudAsset.GetAssetReferences( false ) );
packagesToDownload.AddRange( CloudAsset.GetAssetReferences( true ) );
// 1. remove any installed packages we no longer need
var required = new HashSet<string>();

View File

@@ -280,7 +280,26 @@ public class CloudAsset
string projectPath = Project.Current.GetAssetsPath().Replace( '\\', '/' );
var packages = new HashSet<string>( StringComparer.OrdinalIgnoreCase );
var gr = AssetSystem.All.Where( x => x.AssetType.IsGameResource && (!currentProjectOnly || x.AbsolutePath.StartsWith( projectPath, StringComparison.OrdinalIgnoreCase )) );
HashSet<string> validAssetPaths = null;
if ( currentProjectOnly )
{
validAssetPaths = new HashSet<string>( StringComparer.OrdinalIgnoreCase );
// Include current project
validAssetPaths.Add( projectPath );
// Include all libraries used by the current project
foreach ( var library in LibrarySystem.All )
{
var libraryAssetsPath = library.Project.GetAssetsPath()?.Replace( '\\', '/' );
if ( !string.IsNullOrEmpty( libraryAssetsPath ) )
{
validAssetPaths.Add( libraryAssetsPath );
}
}
}
var gr = AssetSystem.All.Where( x => x.AssetType.IsGameResource && (!currentProjectOnly || validAssetPaths.Any( path => x.AbsolutePath.StartsWith( path, StringComparison.OrdinalIgnoreCase ) )) );
foreach ( var r in gr )
{
string json = null;
@@ -311,7 +330,7 @@ public class CloudAsset
}
}
var nativeResources = AssetSystem.All.Where( x => !x.AssetType.IsGameResource && (!currentProjectOnly || x.AbsolutePath.StartsWith( projectPath, StringComparison.OrdinalIgnoreCase )) ).ToArray();
var nativeResources = AssetSystem.All.Where( x => !x.AssetType.IsGameResource && (!currentProjectOnly || validAssetPaths.Any( path => x.AbsolutePath.StartsWith( path, StringComparison.OrdinalIgnoreCase ) )) ).ToArray();
foreach ( var r in nativeResources )
{
var config = r?.Publishing?.ProjectConfig;