diff --git a/Basis/Packages/com.basis.framework/Avatar/BasisAvatarFactory.cs b/Basis/Packages/com.basis.framework/Avatar/BasisAvatarFactory.cs index cd5e7a422..af81d9099 100644 --- a/Basis/Packages/com.basis.framework/Avatar/BasisAvatarFactory.cs +++ b/Basis/Packages/com.basis.framework/Avatar/BasisAvatarFactory.cs @@ -13,36 +13,34 @@ namespace Basis.Scripts.Avatar { public static class BasisAvatarFactory { - public static BasisLoadableBundle LoadingAvatar = new BasisLoadableBundle() - { - BasisBundleConnector = new BasisBundleConnector() - { - BasisBundleDescription = new BasisBundleDescription() - { - AssetBundleDescription = "LoadingAvatar", - AssetBundleName = "LoadingAvatar" - }, - BasisBundleGenerated = new BasisBundleGenerated[] + public static BasisLoadableBundle LoadingAvatar = new BasisLoadableBundle() + { + BasisBundleConnector = new BasisBundleConnector() + { + BasisBundleDescription = new BasisBundleDescription() + { + AssetBundleDescription = BasisLocalPlayer.DefaultAvatar, + AssetBundleName = BasisLocalPlayer.DefaultAvatar + }, + BasisBundleGenerated = new BasisBundleGenerated[] { new BasisBundleGenerated("N/A","Gameobject",string.Empty,0,true,string.Empty,string.Empty,true,string.Empty) }, - }, - UnlockPassword = "N/A", - BasisRemoteBundleEncrypted = new BasisRemoteEncyptedBundle() - { - BundleURL = "LoadingAvatar", - IsLocal = true, - ConnectorURL = "LoadingAvatar", - }, - BasisLocalEncryptedBundle = new BasisStoredEncryptedBundle() - { - LocalBundleFile = "LoadingAvatar", - LocalConnectorPath = "LoadingAvatar", - }, - }; + }, + UnlockPassword = "N/A", + BasisRemoteBundleEncrypted = new BasisRemoteEncyptedBundle() + { + ConnectorURL = BasisLocalPlayer.DefaultAvatar, + IsLocal = true, + }, + BasisLocalEncryptedBundle = new BasisStoredEncryptedBundle() + { + LocalConnectorPath = BasisLocalPlayer.DefaultAvatar, + }, + }; public static async Task LoadAvatarLocal(BasisLocalPlayer Player,byte Mode, BasisLoadableBundle BasisLoadableBundle) { - if (string.IsNullOrEmpty(BasisLoadableBundle.BasisRemoteBundleEncrypted.BundleURL)) + if (string.IsNullOrEmpty(BasisLoadableBundle.BasisRemoteBundleEncrypted.ConnectorURL)) { BasisDebug.LogError("Avatar Address was empty or null! Falling back to loading avatar."); await LoadAvatarAfterError(Player); @@ -50,42 +48,42 @@ public static async Task LoadAvatarLocal(BasisLocalPlayer Player,byte Mode, Basi } DeleteLastAvatar(Player, false); - LoadLoadingAvatar(Player, LoadingAvatar.BasisLocalEncryptedBundle.LocalBundleFile); + LoadLoadingAvatar(Player, LoadingAvatar.BasisLocalEncryptedBundle.LocalConnectorPath); try { GameObject Output = null; switch (Mode) { case 0://download - BasisDebug.Log("Requested Avatar was a AssetBundle Avatar " + BasisLoadableBundle.BasisRemoteBundleEncrypted.BundleURL, BasisDebug.LogTag.Avatar); + BasisDebug.Log("Requested Avatar was a AssetBundle Avatar " + BasisLoadableBundle.BasisRemoteBundleEncrypted.ConnectorURL, BasisDebug.LogTag.Avatar); Output = await DownloadAndLoadAvatar(BasisLoadableBundle, Player); break; case 1://localload - BasisDebug.Log("Requested Avatar was a Addressable Avatar " + BasisLoadableBundle.BasisRemoteBundleEncrypted.BundleURL, BasisDebug.LogTag.Avatar); + BasisDebug.Log("Requested Avatar was a Addressable Avatar " + BasisLoadableBundle.BasisRemoteBundleEncrypted.ConnectorURL, 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 GameObjects, AddressableGenericResource resource) = await AddressableResourceProcess.LoadAsGameObjectsAsync(BasisLoadableBundle.BasisRemoteBundleEncrypted.BundleURL, Para, Required); + (List GameObjects, AddressableGenericResource resource) = await AddressableResourceProcess.LoadAsGameObjectsAsync(BasisLoadableBundle.BasisRemoteBundleEncrypted.ConnectorURL, Para, Required); if (GameObjects.Count > 0) { - BasisDebug.Log("Found Avatar for " + BasisLoadableBundle.BasisRemoteBundleEncrypted.BundleURL, BasisDebug.LogTag.Avatar); + BasisDebug.Log("Found Avatar for " + BasisLoadableBundle.BasisRemoteBundleEncrypted.ConnectorURL, BasisDebug.LogTag.Avatar); Output = GameObjects[0]; } else { - BasisDebug.LogError("Cant Find Local Avatar for " + BasisLoadableBundle.BasisRemoteBundleEncrypted.BundleURL, BasisDebug.LogTag.Avatar); + BasisDebug.LogError("Cant Find Local Avatar for " + BasisLoadableBundle.BasisRemoteBundleEncrypted.ConnectorURL, BasisDebug.LogTag.Avatar); } break; default: - BasisDebug.Log("Using Default, this means index was out of acceptable range! " + BasisLoadableBundle.BasisRemoteBundleEncrypted.BundleURL, BasisDebug.LogTag.Avatar); + BasisDebug.Log("Using Default, this means index was out of acceptable range! " + BasisLoadableBundle.BasisRemoteBundleEncrypted.ConnectorURL, BasisDebug.LogTag.Avatar); Output = await DownloadAndLoadAvatar(BasisLoadableBundle, Player); break; } - Player.AvatarMetaData = BasisBundleConversionNetwork.ConvertFromNetwork(new AvatarNetworkLoadInformation() { AvatarBundleUrl = BasisLoadableBundle.BasisRemoteBundleEncrypted.BundleURL, AvatarMetaUrl = BasisLoadableBundle.BasisRemoteBundleEncrypted.ConnectorURL, UnlockPassword = BasisLoadableBundle.UnlockPassword }); + Player.AvatarMetaData = BasisBundleConversionNetwork.ConvertFromNetwork(new AvatarNetworkLoadInformation() { URL = BasisLoadableBundle.BasisRemoteBundleEncrypted.ConnectorURL, UnlockPassword = BasisLoadableBundle.UnlockPassword }); Player.AvatarLoadMode = Mode; InitializePlayerAvatar(Player, Output); @@ -101,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.BundleURL)) + if (string.IsNullOrEmpty(BasisLoadableBundle.BasisRemoteBundleEncrypted.ConnectorURL)) { BasisDebug.LogError("Avatar Address was empty or null! Falling back to loading avatar."); await LoadAvatarAfterError(Player); @@ -109,7 +107,7 @@ public static async Task LoadAvatarRemote(BasisRemotePlayer Player,byte Mode, Ba } DeleteLastAvatar(Player,false); - LoadLoadingAvatar(Player, LoadingAvatar.BasisLocalEncryptedBundle.LocalBundleFile); + LoadLoadingAvatar(Player, LoadingAvatar.BasisLocalEncryptedBundle.LocalConnectorPath); try { GameObject Output = null; @@ -119,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.BundleURL, BasisDebug.LogTag.Avatar); + BasisDebug.Log("Requested Avatar was a Addressable Avatar " + BasisLoadableBundle.BasisRemoteBundleEncrypted.ConnectorURL, 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 GameObjects, AddressableGenericResource resource) = await AddressableResourceProcess.LoadAsGameObjectsAsync(BasisLoadableBundle.BasisRemoteBundleEncrypted.BundleURL, Para, Required); + (List GameObjects, AddressableGenericResource resource) = await AddressableResourceProcess.LoadAsGameObjectsAsync(BasisLoadableBundle.BasisRemoteBundleEncrypted.ConnectorURL, Para, Required); if (GameObjects.Count > 0) { - BasisDebug.Log("Found Avatar for " + BasisLoadableBundle.BasisRemoteBundleEncrypted.BundleURL, BasisDebug.LogTag.Avatar); + BasisDebug.Log("Found Avatar for " + BasisLoadableBundle.BasisRemoteBundleEncrypted.ConnectorURL, BasisDebug.LogTag.Avatar); Output = GameObjects[0]; } else { - BasisDebug.LogError("Cant Find Local Avatar for " + BasisLoadableBundle.BasisRemoteBundleEncrypted.BundleURL, BasisDebug.LogTag.Avatar); + BasisDebug.LogError("Cant Find Local Avatar for " + BasisLoadableBundle.BasisRemoteBundleEncrypted.ConnectorURL, BasisDebug.LogTag.Avatar); } break; default: Output = await DownloadAndLoadAvatar(BasisLoadableBundle, Player); break; } - Player.AvatarMetaData = BasisBundleConversionNetwork.ConvertFromNetwork(new AvatarNetworkLoadInformation() { AvatarBundleUrl = BasisLoadableBundle.BasisRemoteBundleEncrypted.BundleURL, AvatarMetaUrl = BasisLoadableBundle.BasisRemoteBundleEncrypted.ConnectorURL, UnlockPassword = BasisLoadableBundle.UnlockPassword }); + Player.AvatarMetaData = BasisBundleConversionNetwork.ConvertFromNetwork(new AvatarNetworkLoadInformation() { URL = BasisLoadableBundle.BasisRemoteBundleEncrypted.ConnectorURL, UnlockPassword = BasisLoadableBundle.UnlockPassword }); Player.AvatarLoadMode = Mode; InitializePlayerAvatar(Player, Output); @@ -204,7 +202,7 @@ public static async Task LoadAvatarAfterError(BasisPlayer Player) DisableAnimatorEvents = false }; var Para = new UnityEngine.ResourceManagement.ResourceProviders.InstantiationParameters(Player.transform.position, Quaternion.identity, null); - (List GameObjects, AddressableGenericResource resource) = await AddressableResourceProcess.LoadAsGameObjectsAsync(LoadingAvatar.BasisLocalEncryptedBundle.LocalBundleFile, Para, Required); + (List GameObjects, AddressableGenericResource resource) = await AddressableResourceProcess.LoadAsGameObjectsAsync(LoadingAvatar.BasisLocalEncryptedBundle.LocalConnectorPath, Para, Required); if (GameObjects.Count != 0) { diff --git a/Basis/Packages/com.basis.framework/Bundle Management/BasisBundleConversionNetwork.cs b/Basis/Packages/com.basis.framework/Bundle Management/BasisBundleConversionNetwork.cs index 87b7dd047..406e957ae 100644 --- a/Basis/Packages/com.basis.framework/Bundle Management/BasisBundleConversionNetwork.cs +++ b/Basis/Packages/com.basis.framework/Bundle Management/BasisBundleConversionNetwork.cs @@ -8,8 +8,7 @@ public static BasisLoadableBundle ConvertFromNetwork(AvatarNetworkLoadInformatio { BasisRemoteBundleEncrypted = new BasisRemoteEncyptedBundle { - ConnectorURL = AvatarNetworkLoadInformation.AvatarMetaUrl, - BundleURL = AvatarNetworkLoadInformation.AvatarBundleUrl + ConnectorURL = AvatarNetworkLoadInformation.URL, }, BasisBundleConnector = new BasisBundleConnector(), BasisLocalEncryptedBundle = new BasisStoredEncryptedBundle(), @@ -24,8 +23,7 @@ public static AvatarNetworkLoadInformation ConvertToNetwork(BasisLoadableBundle { AvatarNetworkLoadInformation AvatarNetworkLoadInformation = new AvatarNetworkLoadInformation { - AvatarMetaUrl = BasisLoadableBundle.BasisRemoteBundleEncrypted.ConnectorURL, - AvatarBundleUrl = BasisLoadableBundle.BasisRemoteBundleEncrypted.BundleURL, + URL = BasisLoadableBundle.BasisRemoteBundleEncrypted.ConnectorURL, UnlockPassword = BasisLoadableBundle.UnlockPassword }; return AvatarNetworkLoadInformation; diff --git a/Basis/Packages/com.basis.framework/Bundle Management/BasisBundleManagement.cs b/Basis/Packages/com.basis.framework/Bundle Management/BasisBundleManagement.cs index c239e7e38..bfe5e2680 100644 --- a/Basis/Packages/com.basis.framework/Bundle Management/BasisBundleManagement.cs +++ b/Basis/Packages/com.basis.framework/Bundle Management/BasisBundleManagement.cs @@ -85,7 +85,7 @@ public static async Task DownloadStoreMetaAndBundle(BasisTrackedBundleWrap } // Step 4: Download the bundle file - string bundleUrl = BasisTrackedBundleWrapper.LoadableBundle.BasisRemoteBundleEncrypted.BundleURL; + string bundleUrl = BasisTrackedBundleWrapper.LoadableBundle.BasisRemoteBundleEncrypted.ConnectorURL; if (string.IsNullOrEmpty(bundleUrl)) { @@ -143,7 +143,7 @@ public static async Task DownloadStoreMetaAndBundle(BasisTrackedBundleWrap } BasisDebug.Log($"Successfully downloaded bundle file for {bundleUrl}"); - BasisTrackedBundleWrapper.LoadableBundle.BasisLocalEncryptedBundle.LocalBundleFile = FilePathBundle; + // BasisTrackedBundleWrapper.LoadableBundle.BasisLocalEncryptedBundle.LocalConnectorPath = FilePathBundle; BasisTrackedBundleWrapper.LoadableBundle.BasisLocalEncryptedBundle.LocalConnectorPath = FilePathMeta; return true; } @@ -303,7 +303,7 @@ public static async Task ProcessOnDiscMetaDataAsync(BasisTrackedBundleWrapper ba } // Set local paths - BasisDebug.Log($"Setting local bundle file: {BasisStoredEncyptedBundle.LocalBundleFile} Setting local meta file: {BasisStoredEncyptedBundle.LocalConnectorPath}"); + BasisDebug.Log($"Setting local bundle file: {BasisStoredEncyptedBundle.LocalConnectorPath} Setting local meta file: {BasisStoredEncyptedBundle.LocalConnectorPath}"); basisTrackedBundleWrapper.LoadableBundle.BasisLocalEncryptedBundle = BasisStoredEncyptedBundle; diff --git a/Basis/Packages/com.basis.framework/Bundle Management/BasisLoadhandler.cs b/Basis/Packages/com.basis.framework/Bundle Management/BasisLoadhandler.cs index 00ea5af2e..8de2c3550 100644 --- a/Basis/Packages/com.basis.framework/Bundle Management/BasisLoadhandler.cs +++ b/Basis/Packages/com.basis.framework/Bundle Management/BasisLoadhandler.cs @@ -165,12 +165,14 @@ private static async Task HandleFirstBundleLoad(BasisLoadableBundle public static async Task HandleBundleAndMetaLoading(BasisTrackedBundleWrapper wrapper, BasisProgressReport report, CancellationToken cancellationToken) { bool IsMetaOnDisc = IsMetaDataOnDisc(wrapper.LoadableBundle.BasisRemoteBundleEncrypted.ConnectorURL, out OnDiscInformation MetaInfo); + /*here LD if(MetaInfo.StoredLocal.LocalConnectorPath) { } - bool IsBundleOnDisc = IsBundleDataOnDisc(wrapper.LoadableBundle.BasisRemoteBundleEncrypted.BundleURL, out OnDiscInformation BundleInfo); - + */ + // bool IsBundleOnDisc = IsBundleDataOnDisc(wrapper.LoadableBundle.BasisRemoteBundleEncrypted.BundleURL, out OnDiscInformation BundleInfo); + bool IsBundleOnDisc = false; if (IsMetaOnDisc) { BasisDebug.Log("ProcessOnDiscMetaDataAsync", BasisDebug.LogTag.Event); @@ -215,7 +217,7 @@ public static async Task HandleBundleAndMetaLoading(BasisTrackedBundleWrapper wr AssetBundleCreateRequest bundleRequest = await BasisEncryptionToData.GenerateBundleFromFile( wrapper.LoadableBundle.UnlockPassword, - wrapper.LoadableBundle.BasisLocalEncryptedBundle.LocalBundleFile, + wrapper.LoadableBundle.BasisLocalEncryptedBundle.LocalConnectorPath, Generated.AssetBundleCRC, report ); @@ -296,10 +298,10 @@ public static bool IsBundleDataOnDisc(string BundleURL, out OnDiscInformation in { foreach (var discInfo in OnDiscData.Values) { - if (discInfo.StoredRemote.BundleURL == BundleURL) + if (discInfo.StoredRemote.ConnectorURL == BundleURL) { info = discInfo; - if (File.Exists(discInfo.StoredLocal.LocalBundleFile)) + if (File.Exists(discInfo.StoredLocal.LocalConnectorPath)) { return true; } @@ -418,6 +420,7 @@ private static void CleanupFiles(BasisStoredEncryptedBundle bundle) { File.Delete(bundle.LocalConnectorPath); } + /* here LD BasisEncryptionToData.GenerateBundleFromFile(, bundle.LocalConnectorPath,bundle); bundle.LocalConnectorPath @@ -425,5 +428,6 @@ private static void CleanupFiles(BasisStoredEncryptedBundle bundle) { File.Delete(bundle.LocalBundleFile); } + */ } } diff --git a/Basis/Packages/com.basis.framework/Device Management/Devices/OpenVR/BasisOpenVRManagment.cs b/Basis/Packages/com.basis.framework/Device Management/Devices/OpenVR/BasisOpenVRManagment.cs index 5a454ade3..9a2d002e2 100644 --- a/Basis/Packages/com.basis.framework/Device Management/Devices/OpenVR/BasisOpenVRManagment.cs +++ b/Basis/Packages/com.basis.framework/Device Management/Devices/OpenVR/BasisOpenVRManagment.cs @@ -23,7 +23,7 @@ public class BasisOpenVRManagement : BasisBaseTypeManagement public Dictionary TypicalDevices = new Dictionary(); public bool IsInUse = false; public static string SteamVRBehaviour = "SteamVR_Behaviour"; - private async void OnDeviceConnected(uint deviceIndex, bool deviceConnected) + private void OnDeviceConnected(uint deviceIndex, bool deviceConnected) { if (deviceIndex != Valve.VR.OpenVR.k_unTrackedDeviceIndexInvalid) { @@ -36,7 +36,7 @@ private async void OnDeviceConnected(uint deviceIndex, bool deviceConnected) string notUnique = id.ToString(); if (deviceConnected) { - await CreateTrackerDevice(deviceIndex, deviceClass, uniqueID, notUnique); + CreateTrackerDevice(deviceIndex, deviceClass, uniqueID, notUnique); } else { @@ -45,7 +45,7 @@ private async void OnDeviceConnected(uint deviceIndex, bool deviceConnected) } } - private async Task CreateTrackerDevice(uint deviceIndex, ETrackedDeviceClass deviceClass, string uniqueID, string notUniqueID) + private void CreateTrackerDevice(uint deviceIndex, ETrackedDeviceClass deviceClass, string uniqueID, string notUniqueID) { OpenVRDevice openVRDevice = new OpenVRDevice { @@ -57,7 +57,7 @@ private async Task CreateTrackerDevice(uint deviceIndex, ETrackedDeviceClass dev switch (deviceClass) { case ETrackedDeviceClass.HMD: - await CreateHMD(openVRDevice, uniqueID, notUniqueID); + CreateHMD(openVRDevice, uniqueID, notUniqueID); break; case ETrackedDeviceClass.Controller: CreateController(openVRDevice, uniqueID, notUniqueID); @@ -71,17 +71,17 @@ private async Task CreateTrackerDevice(uint deviceIndex, ETrackedDeviceClass dev break; case ETrackedDeviceClass.GenericTracker: BasisDebug.Log("Was GenericTracker Device"); - await CreateTracker(openVRDevice, uniqueID, notUniqueID, false, BasisBoneTrackedRole.CenterEye); + CreateTracker(openVRDevice, uniqueID, notUniqueID, false, BasisBoneTrackedRole.CenterEye); break; case ETrackedDeviceClass.DisplayRedirect: BasisDebug.Log("Was DisplayRedirect Device"); break; case ETrackedDeviceClass.Max: BasisDebug.Log("Was Max Device"); - await CreateTracker(openVRDevice, uniqueID, notUniqueID, false, BasisBoneTrackedRole.CenterEye); + CreateTracker(openVRDevice, uniqueID, notUniqueID, false, BasisBoneTrackedRole.CenterEye); break; default: - await CreateTracker(openVRDevice, uniqueID, notUniqueID, false, BasisBoneTrackedRole.CenterEye); + CreateTracker(openVRDevice, uniqueID, notUniqueID, false, BasisBoneTrackedRole.CenterEye); break; } } @@ -93,7 +93,7 @@ public GameObject GenerateGameobject(string uniqueID) }; return gameObject; } - private async Task CreateHMD(OpenVRDevice device, string uniqueID, string notUniqueID) + private void CreateHMD(OpenVRDevice device, string uniqueID, string notUniqueID) { if (!TypicalDevices.ContainsKey(uniqueID)) { @@ -101,7 +101,7 @@ private async Task CreateHMD(OpenVRDevice device, string uniqueID, string notUni var spatial = Output.AddComponent(); spatial.ClassName = nameof(BasisOpenVRInputSpatial); bool foundRole = TryAssignRole(device.deviceClass, device.deviceIndex, notUniqueID, out BasisBoneTrackedRole role, out SteamVR_Input_Sources source); - await spatial.Initialize(UnityEngine.SpatialTracking.TrackedPoseDriver.TrackedPose.Center, uniqueID, notUniqueID, nameof(BasisOpenVRManagement), foundRole, role, source); + spatial.Initialize(UnityEngine.SpatialTracking.TrackedPoseDriver.TrackedPose.Center, uniqueID, notUniqueID, nameof(BasisOpenVRManagement), foundRole, role, source); BasisDeviceManagement.Instance.TryAdd(spatial); TypicalDevices.TryAdd(uniqueID, device); @@ -112,7 +112,7 @@ private async Task CreateHMD(OpenVRDevice device, string uniqueID, string notUni } } - public async void CreateController(OpenVRDevice device, string uniqueID, string notUniqueID) + public void CreateController(OpenVRDevice device, string uniqueID, string notUniqueID) { if (!TypicalDevices.ContainsKey(uniqueID)) { @@ -120,7 +120,7 @@ public async void CreateController(OpenVRDevice device, string uniqueID, string var controller = Output.AddComponent(); controller.ClassName = nameof(BasisOpenVRInputController); bool foundRole = TryAssignRole(device.deviceClass, device.deviceIndex, notUniqueID, out BasisBoneTrackedRole role, out SteamVR_Input_Sources source); - await controller.Initialize(device, uniqueID, notUniqueID, nameof(BasisOpenVRManagement), foundRole, role, source); + controller.Initialize(device, uniqueID, notUniqueID, nameof(BasisOpenVRManagement), foundRole, role, source); BasisDeviceManagement.Instance.TryAdd(controller); TypicalDevices.TryAdd(uniqueID, device); } @@ -130,14 +130,14 @@ public async void CreateController(OpenVRDevice device, string uniqueID, string } } - public async Task CreateTracker(OpenVRDevice device, string uniqueID, string notUniqueID, bool autoAssignRole, BasisBoneTrackedRole role) + public void CreateTracker(OpenVRDevice device, string uniqueID, string notUniqueID, bool autoAssignRole, BasisBoneTrackedRole role) { if (!TypicalDevices.ContainsKey(uniqueID)) { GameObject Output = GenerateGameobject(uniqueID); var input = Output.AddComponent(); input.ClassName = nameof(BasisOpenVRInput); - await input.Initialize(device, uniqueID, notUniqueID, nameof(BasisOpenVRManagement), autoAssignRole, role); + input.Initialize(device, uniqueID, notUniqueID, nameof(BasisOpenVRManagement), autoAssignRole, role); BasisDeviceManagement.Instance.TryAdd(input); TypicalDevices.TryAdd(uniqueID, device); } @@ -204,7 +204,7 @@ public void DestroyPhysicalTrackedDevice(string id) BasisDeviceManagement.Instance.RemoveDevicesFrom(nameof(BasisOpenVRManagement), id); } - private async void HandleExistingDevice(string uniqueID, string notUniqueID, string className, OpenVRDevice device) + private void HandleExistingDevice(string uniqueID, string notUniqueID, string className, OpenVRDevice device) { foreach (BasisInput input in BasisDeviceManagement.Instance.AllInputDevices) { @@ -217,21 +217,21 @@ private async void HandleExistingDevice(string uniqueID, string notUniqueID, str bool foundRole = TryAssignRole(device.deviceClass, device.deviceIndex, notUniqueID, out BasisBoneTrackedRole role, out SteamVR_Input_Sources source); if (role == BasisBoneTrackedRole.Head || role == BasisBoneTrackedRole.CenterEye) { - await spatial.Initialize(UnityEngine.SpatialTracking.TrackedPoseDriver.TrackedPose.Head, uniqueID, notUniqueID, nameof(BasisOpenVRManagement), foundRole, role, source); + spatial.Initialize(UnityEngine.SpatialTracking.TrackedPoseDriver.TrackedPose.Head, uniqueID, notUniqueID, nameof(BasisOpenVRManagement), foundRole, role, source); } else { - await spatial.Initialize(UnityEngine.SpatialTracking.TrackedPoseDriver.TrackedPose.Center, uniqueID, notUniqueID, nameof(BasisOpenVRManagement), foundRole, role, source); + spatial.Initialize(UnityEngine.SpatialTracking.TrackedPoseDriver.TrackedPose.Center, uniqueID, notUniqueID, nameof(BasisOpenVRManagement), foundRole, role, source); } } else if (input is BasisOpenVRInputController controller) { bool foundRole = TryAssignRole(device.deviceClass, device.deviceIndex, notUniqueID, out BasisBoneTrackedRole role, out SteamVR_Input_Sources source); - await controller.Initialize(device, uniqueID, notUniqueID, nameof(BasisOpenVRManagement), foundRole, role, source); + controller.Initialize(device, uniqueID, notUniqueID, nameof(BasisOpenVRManagement), foundRole, role, source); } else if (input is BasisOpenVRInput basisInput) { - await basisInput.Initialize(device, uniqueID, notUniqueID, nameof(BasisOpenVRManagement), false, BasisBoneTrackedRole.CenterEye); + basisInput.Initialize(device, uniqueID, notUniqueID, nameof(BasisOpenVRManagement), false, BasisBoneTrackedRole.CenterEye); } else { diff --git a/Basis/Packages/com.basis.framework/Networking/BasisNetworkSpawnItem.cs b/Basis/Packages/com.basis.framework/Networking/BasisNetworkSpawnItem.cs index 171c248d2..bb5d65125 100644 --- a/Basis/Packages/com.basis.framework/Networking/BasisNetworkSpawnItem.cs +++ b/Basis/Packages/com.basis.framework/Networking/BasisNetworkSpawnItem.cs @@ -137,7 +137,6 @@ public static async Task SpawnScene(LocalLoadResource localLoadResource) { BasisRemoteBundleEncrypted = new BasisRemoteEncyptedBundle() { - BundleURL = localLoadResource.BundleURL, IsLocal = localLoadResource.IsLocalLoad, ConnectorURL = localLoadResource.MetaURL }, @@ -172,7 +171,6 @@ public static async Task SpawnGameObject(LocalLoadResource localLoad { BasisRemoteBundleEncrypted = new BasisRemoteEncyptedBundle() { - BundleURL = localLoadResource.BundleURL, IsLocal = localLoadResource.IsLocalLoad, ConnectorURL = localLoadResource.MetaURL }, diff --git a/Basis/Packages/com.basis.framework/Players/AvatarNetworkLoadInformation.cs b/Basis/Packages/com.basis.framework/Players/AvatarNetworkLoadInformation.cs index 5c309d4d0..71debd23b 100644 --- a/Basis/Packages/com.basis.framework/Players/AvatarNetworkLoadInformation.cs +++ b/Basis/Packages/com.basis.framework/Players/AvatarNetworkLoadInformation.cs @@ -7,8 +7,7 @@ namespace Basis.Scripts.BasisSdk.Players [Serializable] public struct AvatarNetworkLoadInformation { - public string AvatarBundleUrl; - public string AvatarMetaUrl; + public string URL; public string UnlockPassword; /// @@ -19,8 +18,7 @@ public byte[] EncodeToBytes() using var memoryStream = new MemoryStream(); using (var writer = new BinaryWriter(memoryStream)) { - WriteString(writer, AvatarBundleUrl); - WriteString(writer, AvatarMetaUrl); + WriteString(writer, URL); WriteString(writer, UnlockPassword); } @@ -52,8 +50,7 @@ public static AvatarNetworkLoadInformation DecodeFromBytes(byte[] compressedData return new AvatarNetworkLoadInformation { - AvatarBundleUrl = ReadString(reader), - AvatarMetaUrl = ReadString(reader), + URL = ReadString(reader), UnlockPassword = ReadString(reader) }; } diff --git a/Basis/Packages/com.basis.framework/Players/BasisRemotePlayer.cs b/Basis/Packages/com.basis.framework/Players/BasisRemotePlayer.cs index 90079e418..3f719f172 100644 --- a/Basis/Packages/com.basis.framework/Players/BasisRemotePlayer.cs +++ b/Basis/Packages/com.basis.framework/Players/BasisRemotePlayer.cs @@ -70,14 +70,14 @@ public async void CreateAvatar(byte Mode, BasisLoadableBundle BasisLoadableBundl { // if (IsNotFallBack) // { - if (BasisLoadableBundle.BasisLocalEncryptedBundle.LocalBundleFile == BasisAvatarFactory.LoadingAvatar.BasisLocalEncryptedBundle.LocalBundleFile) + if (BasisLoadableBundle.BasisLocalEncryptedBundle.LocalConnectorPath == BasisAvatarFactory.LoadingAvatar.BasisLocalEncryptedBundle.LocalConnectorPath) { BasisDebug.Log("Avatar Load string was null or empty using fallback!"); await BasisAvatarFactory.LoadAvatarRemote(this, BasisPlayer.LoadModeError, BasisLoadableBundle); } else { - BasisDebug.Log("loading avatar from " + BasisLoadableBundle.BasisLocalEncryptedBundle.LocalBundleFile + " with net mode " + Mode); + BasisDebug.Log("loading avatar from " + BasisLoadableBundle.BasisLocalEncryptedBundle.LocalConnectorPath + " with net mode " + Mode); if (LockAvatarFromChanging == false) { await BasisAvatarFactory.LoadAvatarRemote(this, Mode, BasisLoadableBundle); diff --git a/Basis/Packages/com.basis.sdk/Scripts/Editor/AssetBundleBuilder/BasisAssetBundlePipeline.cs b/Basis/Packages/com.basis.sdk/Scripts/Editor/AssetBundleBuilder/BasisAssetBundlePipeline.cs index bbe30cfac..f43cfac75 100644 --- a/Basis/Packages/com.basis.sdk/Scripts/Editor/AssetBundleBuilder/BasisAssetBundlePipeline.cs +++ b/Basis/Packages/com.basis.sdk/Scripts/Editor/AssetBundleBuilder/BasisAssetBundlePipeline.cs @@ -2,6 +2,7 @@ using System.IO; using System.Threading.Tasks; using UnityEditor; +using UnityEditor.Build; using UnityEngine; using UnityEngine.SceneManagement; using Object = UnityEngine.Object; @@ -62,11 +63,13 @@ public static void ClearOutExistingSets() } public static async Task<(bool,BasisBundleGenerated)> BuildAssetBundle(bool isScene, GameObject asset, Scene scene, BasisAssetBundleObject settings, string Password, BuildTarget Target) { + ScriptingImplementation ResetTo = ScriptingImplementation.IL2CPP; if (EditorUserBuildSettings.activeBuildTarget != Target) { EditorUserBuildSettings.SwitchActiveBuildTarget(BuildPipeline.GetBuildTargetGroup(Target), Target); } + ApplyScriptingBackend( ScriptingImplementation.Mono2x,out ResetTo); ClearOutExistingSets(); // Removes all bundle names string targetDirectory = Path.Combine(settings.AssetBundleDirectory, Target.ToString()); TemporaryStorageHandler.ClearTemporaryStorage(targetDirectory); @@ -117,6 +120,14 @@ public static void ClearOutExistingSets() { OnAfterBuildPrefab?.Invoke(assetBundleName); } + + BuildTarget buildTarget = EditorUserBuildSettings.activeBuildTarget; + BuildTargetGroup targetGroup = BuildPipeline.GetBuildTargetGroup(buildTarget); + var namedBuildTarget = UnityEditor.Build.NamedBuildTarget.FromBuildTargetGroup(targetGroup); + if (ResetTo != PlayerSettings.GetScriptingBackend(namedBuildTarget)) + { + PlayerSettings.SetScriptingBackend(namedBuildTarget, ResetTo); + } return new(true, BasisBundleGenerated); } catch (Exception ex) @@ -132,8 +143,25 @@ public static void ClearOutExistingSets() BasisBundleErrorHandler.HandleBuildError(ex, asset, wasModified, settings.TemporaryStorage); EditorUtility.DisplayDialog("Failed To Build", "Please check the console for the full issue: " + ex, "Will do"); } - + BuildTarget buildTarget = EditorUserBuildSettings.activeBuildTarget; + BuildTargetGroup targetGroup = BuildPipeline.GetBuildTargetGroup(buildTarget); + var namedBuildTarget = UnityEditor.Build.NamedBuildTarget.FromBuildTargetGroup(targetGroup); + if (ResetTo != PlayerSettings.GetScriptingBackend(namedBuildTarget)) + { + PlayerSettings.SetScriptingBackend(namedBuildTarget, ResetTo); + } return new(false, null); } } + public static void ApplyScriptingBackend(ScriptingImplementation ScriptingImplementation,out ScriptingImplementation ResetTo) + { + BuildTarget buildTarget = EditorUserBuildSettings.activeBuildTarget; + BuildTargetGroup targetGroup = BuildPipeline.GetBuildTargetGroup(buildTarget); + var namedBuildTarget = UnityEditor.Build.NamedBuildTarget.FromBuildTargetGroup(targetGroup); + ResetTo = PlayerSettings.GetScriptingBackend(namedBuildTarget); + if (ResetTo != ScriptingImplementation) + { + PlayerSettings.SetScriptingBackend(namedBuildTarget, ScriptingImplementation); + } + } } diff --git a/Basis/Packages/com.basis.sdk/Scripts/Editor/SDKInspector/BasisAvatarSDKInspector.cs b/Basis/Packages/com.basis.sdk/Scripts/Editor/SDKInspector/BasisAvatarSDKInspector.cs index 73dd48021..486b1fba9 100644 --- a/Basis/Packages/com.basis.sdk/Scripts/Editor/SDKInspector/BasisAvatarSDKInspector.cs +++ b/Basis/Packages/com.basis.sdk/Scripts/Editor/SDKInspector/BasisAvatarSDKInspector.cs @@ -21,7 +21,6 @@ public partial class BasisAvatarSDKInspector : Editor public AvatarSDKJiggleBonesView AvatarSDKJiggleBonesView = new AvatarSDKJiggleBonesView(); public AvatarSDKVisemes AvatarSDKVisemes = new AvatarSDKVisemes(); public Button EventCallbackAvatarBundleButton { get; private set; } - private bool IsIL2CPPIsInstalled; public Texture2D Texture; private Label resultLabel; // Store the result label for later clearing private List selectedTargets = new List(); @@ -30,7 +29,6 @@ private void OnEnable() { visualTree = AssetDatabase.LoadAssetAtPath(BasisSDKConstants.AvataruxmlPath); Avatar = (BasisAvatar)target; - IsIL2CPPIsInstalled = BasisBundleBuild.CheckIfWeCanBuild(new List() { EditorUserBuildSettings.activeBuildTarget },out string Error); // Initialize selectedTargets with all available targets selectedTargets = new List(BasisSDKConstants.allowedTargets); } @@ -250,16 +248,8 @@ public void SetupItems() avatarEyePositionClick.text = "Eye Position Gizmo " + AvatarHelper.BoolToText(AvatarEyePositionState); avatarMouthPositionClick.text = "Mouth Position Gizmo " + AvatarHelper.BoolToText(AvatarMouthPositionState); - if (!IsIL2CPPIsInstalled) - { - ErrorMessage.visible = true; - ErrorMessage.text = Error; - } - else - { - ErrorMessage.visible = false; - ErrorMessage.text = ""; - } + ErrorMessage.visible = false; + ErrorMessage.text = ""; } private async void EventCallbackAvatarBundle(List targets) { diff --git a/Basis/Packages/com.basis.sdk/Scripts/Editor/SDKInspector/BasisBundleBuild.cs b/Basis/Packages/com.basis.sdk/Scripts/Editor/SDKInspector/BasisBundleBuild.cs index f01b9788b..9cd08b1de 100644 --- a/Basis/Packages/com.basis.sdk/Scripts/Editor/SDKInspector/BasisBundleBuild.cs +++ b/Basis/Packages/com.basis.sdk/Scripts/Editor/SDKInspector/BasisBundleBuild.cs @@ -5,6 +5,7 @@ using System.Text; using System.Threading.Tasks; using UnityEditor; +using UnityEditor.Build; using UnityEngine; public static class BasisBundleBuild @@ -30,11 +31,6 @@ public static class BasisBundleBuild return (false, Error); } - if (CheckIfWeCanBuild(Targets, out Error) == false) - { - return (false, Error); - } - Debug.Log("Passed error checking for BuildBundle..."); // Ensure active build target is first in the list @@ -60,8 +56,6 @@ public static class BasisBundleBuild string hexString = ByteArrayToHexString(randomBytes); Debug.Log($"Generated hex string: {hexString}"); - Debug.Log("IL2CPP is installed. Proceeding to build asset bundle..."); - BasisBundleGenerated[] Bundles = new BasisBundleGenerated[Targets.Count]; for (int Index = 0; Index < Targets.Count; Index++) { @@ -200,52 +194,6 @@ public static bool ErrorChecking(BasisContentBase BasisContentBase, out string E return true; } - - public static bool CheckIfWeCanBuild(List Targets, out string Error) - { - for (int Index = 0; Index < Targets.Count; Index++) - { - BuildTarget item = Targets[Index]; - - // if (IsPlatformInstalled(item) == false) - // { - // Error = "Missing Platform for " + item + " please install from the Unity Hub, make sure to include IL2CPP"; - // return false; - // } - - var playbackEndingDirectory = BuildPipeline.GetPlaybackEngineDirectory(item, BuildOptions.None, false); - bool isInstalled = !string.IsNullOrEmpty(playbackEndingDirectory) && Directory.Exists(Path.Combine(playbackEndingDirectory, "Variations", "il2cpp")); - - if (isInstalled == false) - { - Error = "IL2CPP is NOT installed for platform " + item + " please add it from the unity hub!"; - return false; - } - } - Error = string.Empty; - return true; - } - - static bool IsPlatformInstalled(BuildTarget target) - { - // Use Unity's method to check for the platform installation - string playbackEnginePath = BuildPipeline.GetPlaybackEngineDirectory(target, BuildOptions.None, false); - - if (string.IsNullOrEmpty(playbackEnginePath)) - { - return false; // If no path returned, platform isn't installed - } - - // Special check for StandaloneWindows64 which might be named differently in the folder structure - if (target == BuildTarget.StandaloneWindows64) - { - // Check if the "windows64" folder exists in the PlaybackEngines directory - return Directory.Exists(Path.Combine(playbackEnginePath, "windows64")); - } - - // For all other platforms, we rely on the normal method - return Directory.Exists(playbackEnginePath); - } // Generates a random byte array of specified length public static byte[] GenerateRandomBytes(int length) { diff --git a/Basis/Packages/packages-lock.json b/Basis/Packages/packages-lock.json index c979a35d4..47f85db4a 100644 --- a/Basis/Packages/packages-lock.json +++ b/Basis/Packages/packages-lock.json @@ -297,7 +297,7 @@ "url": "https://packages.unity.com" }, "com.unity.searcher": { - "version": "4.9.3", + "version": "4.9.2", "depth": 2, "source": "registry", "dependencies": {}, @@ -309,7 +309,7 @@ "source": "builtin", "dependencies": { "com.unity.render-pipelines.core": "17.0.3", - "com.unity.searcher": "4.9.3" + "com.unity.searcher": "4.9.2" } }, "com.unity.sysroot": { @@ -329,7 +329,7 @@ "url": "https://packages.unity.com" }, "com.unity.test-framework": { - "version": "1.4.6", + "version": "1.4.5", "depth": 1, "source": "registry", "dependencies": { @@ -373,7 +373,7 @@ }, "com.unity.ugui": { "version": "2.0.0", - "depth": 1, + "depth": 2, "source": "builtin", "dependencies": { "com.unity.modules.ui": "1.0.0", @@ -399,7 +399,7 @@ "url": "https://packages.unity.com" }, "com.unity.xr.legacyinputhelpers": { - "version": "2.1.12", + "version": "2.1.11", "depth": 1, "source": "registry", "dependencies": {