Skip to content

Commit

Permalink
more work on the bundle system
Browse files Browse the repository at this point in the history
  • Loading branch information
dooly123 committed Feb 26, 2025
1 parent 720d431 commit 6f3821c
Show file tree
Hide file tree
Showing 14 changed files with 193 additions and 251 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ MonoBehaviour:
m_RequireOpaqueTexture: 1
m_OpaqueDownsampling: 1
m_SupportsTerrainHoles: 0
m_SupportsHDR: 0
m_HDRColorBufferPrecision: 0
m_SupportsHDR: 1
m_HDRColorBufferPrecision: 1
m_MSAA: 1
m_RenderScale: 1.041047
m_RenderScale: 1
m_UpscalingFilter: 0
m_FsrOverrideSharpness: 0
m_FsrSharpness: 0.92
Expand All @@ -43,17 +43,17 @@ MonoBehaviour:
m_ProbeVolumeSHBands: 1
m_MainLightRenderingMode: 1
m_MainLightShadowsSupported: 1
m_MainLightShadowmapResolution: 256
m_MainLightShadowmapResolution: 8192
m_AdditionalLightsRenderingMode: 1
m_AdditionalLightsPerObjectLimit: 0
m_AdditionalLightsPerObjectLimit: 8
m_AdditionalLightShadowsSupported: 1
m_AdditionalLightsShadowmapResolution: 256
m_AdditionalLightsShadowmapResolution: 8192
m_AdditionalLightsShadowResolutionTierLow: 128
m_AdditionalLightsShadowResolutionTierMedium: 256
m_AdditionalLightsShadowResolutionTierHigh: 512
m_ReflectionProbeBlending: 1
m_ReflectionProbeBoxProjection: 1
m_ShadowDistance: 5
m_ShadowDistance: 150
m_ShadowCascadeCount: 4
m_Cascade2Split: 0.12
m_Cascade3Split: {x: 0.12, y: 0.5}
Expand Down Expand Up @@ -108,7 +108,7 @@ MonoBehaviour:
m_PrefilteringModeScreenSpaceOcclusion: 0
m_PrefilterDebugKeywords: 1
m_PrefilterWriteRenderingLayers: 0
m_PrefilterHDROutput: 1
m_PrefilterHDROutput: 0
m_PrefilterAlphaOutput: 1
m_PrefilterSSAODepthNormals: 1
m_PrefilterSSAOSourceDepthLow: 1
Expand Down
32 changes: 16 additions & 16 deletions Basis/Packages/com.basis.framework/Avatar/BasisAvatarFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static class BasisAvatarFactory
UnlockPassword = "N/A",
BasisRemoteBundleEncrypted = new BasisRemoteEncyptedBundle()
{
ConnectorURL = BasisLocalPlayer.DefaultAvatar,
CombinedURL = BasisLocalPlayer.DefaultAvatar,
IsLocal = true,
},
BasisLocalEncryptedBundle = new BasisStoredEncryptedBundle()
Expand All @@ -40,7 +40,7 @@ public static class BasisAvatarFactory
};
public static async Task LoadAvatarLocal(BasisLocalPlayer Player,byte Mode, BasisLoadableBundle BasisLoadableBundle)
{
if (string.IsNullOrEmpty(BasisLoadableBundle.BasisRemoteBundleEncrypted.ConnectorURL))
if (string.IsNullOrEmpty(BasisLoadableBundle.BasisRemoteBundleEncrypted.CombinedURL))
{
BasisDebug.LogError("Avatar Address was empty or null! Falling back to loading avatar.");
await LoadAvatarAfterError(Player);
Expand All @@ -55,35 +55,35 @@ public static async Task LoadAvatarLocal(BasisLocalPlayer Player,byte Mode, Basi
switch (Mode)
{
case 0://download
BasisDebug.Log("Requested Avatar was a AssetBundle Avatar " + BasisLoadableBundle.BasisRemoteBundleEncrypted.ConnectorURL, BasisDebug.LogTag.Avatar);
BasisDebug.Log("Requested Avatar was a AssetBundle Avatar " + BasisLoadableBundle.BasisRemoteBundleEncrypted.CombinedURL, BasisDebug.LogTag.Avatar);
Output = await DownloadAndLoadAvatar(BasisLoadableBundle, Player);
break;
case 1://localload
BasisDebug.Log("Requested Avatar was a Addressable Avatar " + BasisLoadableBundle.BasisRemoteBundleEncrypted.ConnectorURL, BasisDebug.LogTag.Avatar);
BasisDebug.Log("Requested Avatar was a Addressable Avatar " + BasisLoadableBundle.BasisRemoteBundleEncrypted.CombinedURL, BasisDebug.LogTag.Avatar);
var Para = new UnityEngine.ResourceManagement.ResourceProviders.InstantiationParameters(Player.transform.position, Quaternion.identity, null);
ChecksRequired Required = new ChecksRequired
{
UseContentRemoval = true,
DisableAnimatorEvents = false
};
(List<GameObject> GameObjects, AddressableGenericResource resource) = await AddressableResourceProcess.LoadAsGameObjectsAsync(BasisLoadableBundle.BasisRemoteBundleEncrypted.ConnectorURL, Para, Required);
(List<GameObject> GameObjects, AddressableGenericResource resource) = await AddressableResourceProcess.LoadAsGameObjectsAsync(BasisLoadableBundle.BasisRemoteBundleEncrypted.CombinedURL, Para, Required);

if (GameObjects.Count > 0)
{
BasisDebug.Log("Found Avatar for " + BasisLoadableBundle.BasisRemoteBundleEncrypted.ConnectorURL, BasisDebug.LogTag.Avatar);
BasisDebug.Log("Found Avatar for " + BasisLoadableBundle.BasisRemoteBundleEncrypted.CombinedURL, BasisDebug.LogTag.Avatar);
Output = GameObjects[0];
}
else
{
BasisDebug.LogError("Cant Find Local Avatar for " + BasisLoadableBundle.BasisRemoteBundleEncrypted.ConnectorURL, BasisDebug.LogTag.Avatar);
BasisDebug.LogError("Cant Find Local Avatar for " + BasisLoadableBundle.BasisRemoteBundleEncrypted.CombinedURL, BasisDebug.LogTag.Avatar);
}
break;
default:
BasisDebug.Log("Using Default, this means index was out of acceptable range! " + BasisLoadableBundle.BasisRemoteBundleEncrypted.ConnectorURL, BasisDebug.LogTag.Avatar);
BasisDebug.Log("Using Default, this means index was out of acceptable range! " + BasisLoadableBundle.BasisRemoteBundleEncrypted.CombinedURL, BasisDebug.LogTag.Avatar);
Output = await DownloadAndLoadAvatar(BasisLoadableBundle, Player);
break;
}
Player.AvatarMetaData = BasisBundleConversionNetwork.ConvertFromNetwork(new AvatarNetworkLoadInformation() { URL = BasisLoadableBundle.BasisRemoteBundleEncrypted.ConnectorURL, UnlockPassword = BasisLoadableBundle.UnlockPassword });
Player.AvatarMetaData = BasisBundleConversionNetwork.ConvertFromNetwork(new AvatarNetworkLoadInformation() { URL = BasisLoadableBundle.BasisRemoteBundleEncrypted.CombinedURL, UnlockPassword = BasisLoadableBundle.UnlockPassword });
Player.AvatarLoadMode = Mode;

InitializePlayerAvatar(Player, Output);
Expand All @@ -99,7 +99,7 @@ public static async Task LoadAvatarLocal(BasisLocalPlayer Player,byte Mode, Basi

public static async Task LoadAvatarRemote(BasisRemotePlayer Player,byte Mode, BasisLoadableBundle BasisLoadableBundle)
{
if (string.IsNullOrEmpty(BasisLoadableBundle.BasisRemoteBundleEncrypted.ConnectorURL))
if (string.IsNullOrEmpty(BasisLoadableBundle.BasisRemoteBundleEncrypted.CombinedURL))
{
BasisDebug.LogError("Avatar Address was empty or null! Falling back to loading avatar.");
await LoadAvatarAfterError(Player);
Expand All @@ -117,30 +117,30 @@ public static async Task LoadAvatarRemote(BasisRemotePlayer Player,byte Mode, Ba
Output = await DownloadAndLoadAvatar(BasisLoadableBundle, Player);
break;
case 1://localload
BasisDebug.Log("Requested Avatar was a Addressable Avatar " + BasisLoadableBundle.BasisRemoteBundleEncrypted.ConnectorURL, BasisDebug.LogTag.Avatar);
BasisDebug.Log("Requested Avatar was a Addressable Avatar " + BasisLoadableBundle.BasisRemoteBundleEncrypted.CombinedURL, BasisDebug.LogTag.Avatar);
ChecksRequired Required = new ChecksRequired
{
UseContentRemoval = false,
DisableAnimatorEvents = false
};
var Para = new UnityEngine.ResourceManagement.ResourceProviders.InstantiationParameters(Player.transform.position, Quaternion.identity, null);
(List<GameObject> GameObjects, AddressableGenericResource resource) = await AddressableResourceProcess.LoadAsGameObjectsAsync(BasisLoadableBundle.BasisRemoteBundleEncrypted.ConnectorURL, Para, Required);
(List<GameObject> GameObjects, AddressableGenericResource resource) = await AddressableResourceProcess.LoadAsGameObjectsAsync(BasisLoadableBundle.BasisRemoteBundleEncrypted.CombinedURL, Para, Required);

if (GameObjects.Count > 0)
{
BasisDebug.Log("Found Avatar for " + BasisLoadableBundle.BasisRemoteBundleEncrypted.ConnectorURL, BasisDebug.LogTag.Avatar);
BasisDebug.Log("Found Avatar for " + BasisLoadableBundle.BasisRemoteBundleEncrypted.CombinedURL, BasisDebug.LogTag.Avatar);
Output = GameObjects[0];
}
else
{
BasisDebug.LogError("Cant Find Local Avatar for " + BasisLoadableBundle.BasisRemoteBundleEncrypted.ConnectorURL, BasisDebug.LogTag.Avatar);
BasisDebug.LogError("Cant Find Local Avatar for " + BasisLoadableBundle.BasisRemoteBundleEncrypted.CombinedURL, BasisDebug.LogTag.Avatar);
}
break;
default:
Output = await DownloadAndLoadAvatar(BasisLoadableBundle, Player);
break;
}
Player.AvatarMetaData = BasisBundleConversionNetwork.ConvertFromNetwork(new AvatarNetworkLoadInformation() { URL = BasisLoadableBundle.BasisRemoteBundleEncrypted.ConnectorURL, UnlockPassword = BasisLoadableBundle.UnlockPassword });
Player.AvatarMetaData = BasisBundleConversionNetwork.ConvertFromNetwork(new AvatarNetworkLoadInformation() { URL = BasisLoadableBundle.BasisRemoteBundleEncrypted.CombinedURL, UnlockPassword = BasisLoadableBundle.UnlockPassword });
Player.AvatarLoadMode = Mode;

InitializePlayerAvatar(Player, Output);
Expand Down Expand Up @@ -271,7 +271,7 @@ public static async void DeleteLastAvatar(BasisPlayer Player,bool IsRemovingFall
}
else
{
await BasisLoadHandler.DestroyGameobject(Player.BasisAvatar.gameObject, Player.AvatarMetaData.BasisRemoteBundleEncrypted.ConnectorURL, false);
await BasisLoadHandler.DestroyGameobject(Player.BasisAvatar.gameObject, Player.AvatarMetaData.BasisRemoteBundleEncrypted.CombinedURL, false);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public static BasisLoadableBundle ConvertFromNetwork(AvatarNetworkLoadInformatio
{
BasisRemoteBundleEncrypted = new BasisRemoteEncyptedBundle
{
ConnectorURL = AvatarNetworkLoadInformation.URL,
CombinedURL = AvatarNetworkLoadInformation.URL,
},
BasisBundleConnector = new BasisBundleConnector(),
BasisLocalEncryptedBundle = new BasisStoredEncryptedBundle(),
Expand All @@ -23,7 +23,7 @@ public static AvatarNetworkLoadInformation ConvertToNetwork(BasisLoadableBundle
{
AvatarNetworkLoadInformation AvatarNetworkLoadInformation = new AvatarNetworkLoadInformation
{
URL = BasisLoadableBundle.BasisRemoteBundleEncrypted.ConnectorURL,
URL = BasisLoadableBundle.BasisRemoteBundleEncrypted.CombinedURL,
UnlockPassword = BasisLoadableBundle.UnlockPassword
};
return AvatarNetworkLoadInformation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static async Task<bool> DownloadStoreMetaAndBundle(BasisTrackedBundleWrap
return false;
}

string metaUrl = BasisTrackedBundleWrapper.LoadableBundle.BasisRemoteBundleEncrypted.ConnectorURL;
string metaUrl = BasisTrackedBundleWrapper.LoadableBundle.BasisRemoteBundleEncrypted.CombinedURL;

if (string.IsNullOrEmpty(metaUrl))
{
Expand All @@ -41,11 +41,6 @@ public static async Task<bool> DownloadStoreMetaAndBundle(BasisTrackedBundleWrap
BasisDebug.Log($"Downloading meta file for {metaUrl}");

string UniqueDownload = BasisGenerateUniqueID.GenerateUniqueID();
if (string.IsNullOrEmpty(UniqueDownload))
{
BasisDebug.LogError("Failed to generate a unique ID.");
return false;
}

string UniqueFilePath = BasisIOManagement.GenerateFilePath($"Temp_{UniqueDownload}{EncryptedMetaBasisSuffix}", LockedBundlesFolder);
if (string.IsNullOrEmpty(UniqueFilePath))
Expand All @@ -61,17 +56,17 @@ public static async Task<bool> DownloadStoreMetaAndBundle(BasisTrackedBundleWrap

if (BasisTrackedBundleWrapper.LoadableBundle.BasisRemoteBundleEncrypted.IsLocal)
{
if (!File.Exists(BasisTrackedBundleWrapper.LoadableBundle.BasisRemoteBundleEncrypted.ConnectorURL))
if (!File.Exists(BasisTrackedBundleWrapper.LoadableBundle.BasisRemoteBundleEncrypted.CombinedURL))
{
BasisDebug.LogError($"Local meta file not found: {metaUrl}");
return false;
}

File.Copy(BasisTrackedBundleWrapper.LoadableBundle.BasisRemoteBundleEncrypted.ConnectorURL, UniqueFilePath); // The goal here is just to get the data out
File.Copy(BasisTrackedBundleWrapper.LoadableBundle.BasisRemoteBundleEncrypted.CombinedURL, UniqueFilePath); // The goal here is just to get the data out
}
else
{
await BasisIOManagement.DownloadFile(metaUrl, UniqueFilePath, progressCallback, cancellationToken);
await BasisIOManagement.DownloadBEE(metaUrl, UniqueFilePath, progressCallback, cancellationToken);
}

BasisDebug.Log($"Successfully downloaded meta file for {metaUrl} Decrypting meta file...");
Expand All @@ -85,7 +80,7 @@ public static async Task<bool> DownloadStoreMetaAndBundle(BasisTrackedBundleWrap
}

// Step 4: Download the bundle file
string bundleUrl = BasisTrackedBundleWrapper.LoadableBundle.BasisRemoteBundleEncrypted.ConnectorURL;
string bundleUrl = BasisTrackedBundleWrapper.LoadableBundle.BasisRemoteBundleEncrypted.CombinedURL;

if (string.IsNullOrEmpty(bundleUrl))
{
Expand Down Expand Up @@ -139,7 +134,7 @@ public static async Task<bool> DownloadStoreMetaAndBundle(BasisTrackedBundleWrap
}
else
{
await BasisIOManagement.DownloadFile(bundleUrl, FilePathBundle, progressCallback, cancellationToken);
await BasisIOManagement.DownloadBEE(bundleUrl, FilePathBundle, progressCallback, cancellationToken);
}

BasisDebug.Log($"Successfully downloaded bundle file for {bundleUrl}");
Expand Down Expand Up @@ -173,7 +168,7 @@ public static async Task<bool> DownloadAndSaveMetaFile(BasisTrackedBundleWrapper
return false;
}

string metaUrl = BasisTrackedBundleWrapper.LoadableBundle.BasisRemoteBundleEncrypted.ConnectorURL;
string metaUrl = BasisTrackedBundleWrapper.LoadableBundle.BasisRemoteBundleEncrypted.CombinedURL;

if (string.IsNullOrEmpty(metaUrl))
{
Expand Down Expand Up @@ -208,17 +203,17 @@ public static async Task<bool> DownloadAndSaveMetaFile(BasisTrackedBundleWrapper

if (BasisTrackedBundleWrapper.LoadableBundle.BasisRemoteBundleEncrypted.IsLocal)
{
if (!File.Exists(BasisTrackedBundleWrapper.LoadableBundle.BasisRemoteBundleEncrypted.ConnectorURL))
if (!File.Exists(BasisTrackedBundleWrapper.LoadableBundle.BasisRemoteBundleEncrypted.CombinedURL))
{
BasisDebug.LogError($"Local meta file not found: {metaUrl}");
return false;
}

File.Copy(BasisTrackedBundleWrapper.LoadableBundle.BasisRemoteBundleEncrypted.ConnectorURL, UniqueFilePath); // The goal here is just to get the data out
File.Copy(BasisTrackedBundleWrapper.LoadableBundle.BasisRemoteBundleEncrypted.CombinedURL, UniqueFilePath); // The goal here is just to get the data out
}
else
{
await BasisIOManagement.DownloadFile(metaUrl, UniqueFilePath, progressCallback, cancellationToken);
await BasisIOManagement.DownloadBEE(metaUrl, UniqueFilePath, progressCallback, cancellationToken);
}

BasisDebug.Log($"Successfully downloaded meta file for {metaUrl}. Decrypting meta file...");
Expand Down Expand Up @@ -308,7 +303,7 @@ public static async Task ProcessOnDiscMetaDataAsync(BasisTrackedBundleWrapper ba
basisTrackedBundleWrapper.LoadableBundle.BasisLocalEncryptedBundle = BasisStoredEncyptedBundle;

// Fetching the meta URL
string metaUrl = basisTrackedBundleWrapper.LoadableBundle.BasisRemoteBundleEncrypted.ConnectorURL;
string metaUrl = basisTrackedBundleWrapper.LoadableBundle.BasisRemoteBundleEncrypted.CombinedURL;
if (string.IsNullOrEmpty(metaUrl))
{
BasisDebug.LogError("MetaURL is null or empty. Exiting method.");
Expand Down
Loading

0 comments on commit 6f3821c

Please sign in to comment.