app.hypergames.hypersdk 1.2.1 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [1.2.2](https://github.com/mvmhyper/hyper-sdk/compare/v1.2.1...v1.2.2) (2025-11-26)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * auto-manage HyperLoader scene and constants ([050567a](https://github.com/mvmhyper/hyper-sdk/commit/050567a44c0d78b4eed9ae31b19ba1fcbd8a986f))
7
+
1
8
  ## [1.2.1](https://github.com/mvmhyper/hyper-sdk/compare/v1.2.0...v1.2.1) (2025-11-26)
2
9
 
3
10
 
@@ -4,6 +4,7 @@ using UnityEditor;
4
4
  using System;
5
5
  using System.Collections.Generic;
6
6
  using System.Globalization;
7
+ using System.IO;
7
8
  using System.Linq;
8
9
  using UnityEditor.Build;
9
10
  using UnityEditor.Build.Reporting;
@@ -1010,61 +1011,25 @@ namespace Hyper.Editor
1010
1011
  break;
1011
1012
 
1012
1013
  case SettingType.HyperLoaderSceneIndex:
1013
- try
1014
1014
  {
1015
- var scenes = new List<EditorBuildSettingsScene>(EditorBuildSettings.scenes);
1016
- int hyperLoaderIndex = -1;
1017
-
1018
- for (int i = 0; i < scenes.Count; i++)
1015
+ if (TryEnsureSceneAtIndex(HyperConstants.HYPER_LOADER_SCENE_PATH, 0, out var sceneError))
1019
1016
  {
1020
- if (scenes[i].path.Contains("HyperLoader") ||
1021
- scenes[i].path.EndsWith("HyperLoader.unity", System.StringComparison.OrdinalIgnoreCase))
1022
- {
1023
- hyperLoaderIndex = i;
1024
- break;
1025
- }
1017
+ if (IsSDKDeveloper()) HyperDebug.LogSuccess("Applied: HyperLoader scene moved to build index 0");
1026
1018
  }
1027
-
1028
- if (hyperLoaderIndex == -1)
1019
+ else
1029
1020
  {
1030
1021
  EditorUtility.DisplayDialog(
1031
1022
  "HyperLoader Scene Not Found",
1032
- "HyperLoader scene not found in Build Settings.\n\n" +
1033
- "Please add it manually:\n" +
1034
- "1. File > Build Settings\n" +
1035
- "2. Add Open Scenes or drag HyperLoader.unity\n" +
1036
- "3. Move it to index 0",
1023
+ $"Could not locate the HyperLoader scene at:\n{HyperConstants.HYPER_LOADER_SCENE_PATH}\n\n" +
1024
+ "Please ensure the SDK is installed and the scene exists, then run this fix again.",
1037
1025
  "OK"
1038
1026
  );
1039
- HyperDebug.LogWarning("HyperLoader scene not found in Build Settings");
1040
- }
1041
- else if (hyperLoaderIndex == 0)
1042
- {
1043
- if (IsSDKDeveloper()) HyperDebug.Log("HyperLoader is already at index 0");
1044
- }
1045
- else
1046
- {
1047
- var hyperLoaderScene = scenes[hyperLoaderIndex];
1048
- scenes.RemoveAt(hyperLoaderIndex);
1049
- scenes.Insert(0, hyperLoaderScene);
1050
- hyperLoaderScene.enabled = true;
1051
-
1052
- EditorBuildSettings.scenes = scenes.ToArray();
1053
- if (IsSDKDeveloper()) HyperDebug.LogSuccess($"Applied: Moved HyperLoader scene to build index 0 (was at index {hyperLoaderIndex})");
1027
+ if (!string.IsNullOrEmpty(sceneError))
1028
+ {
1029
+ HyperDebug.LogWarning(sceneError);
1030
+ }
1054
1031
  }
1055
1032
  }
1056
- catch (System.Exception e)
1057
- {
1058
- EditorUtility.DisplayDialog(
1059
- "Build Settings Error",
1060
- "Could not automatically move HyperLoader to index 0.\n\n" +
1061
- "Please manually set it in:\n" +
1062
- "File > Build Settings\n\n" +
1063
- "Move HyperLoader scene to index 0",
1064
- "OK"
1065
- );
1066
- HyperDebug.LogWarning($"Could not move HyperLoader scene: {e.Message}");
1067
- }
1068
1033
  break;
1069
1034
 
1070
1035
  case SettingType.ColorSpace:
@@ -1466,6 +1431,39 @@ namespace Hyper.Editor
1466
1431
  return $"{len:0.##} {sizes[order]}";
1467
1432
  }
1468
1433
 
1434
+ #endregion
1435
+
1436
+ #region Build Settings Helpers
1437
+
1438
+ private static bool TryEnsureSceneAtIndex(string scenePath, int targetIndex, out string errorMessage)
1439
+ {
1440
+ errorMessage = null;
1441
+
1442
+ if (string.IsNullOrEmpty(scenePath))
1443
+ {
1444
+ errorMessage = "Scene path is null or empty.";
1445
+ return false;
1446
+ }
1447
+
1448
+ if (!File.Exists(scenePath))
1449
+ {
1450
+ errorMessage = $"Scene not found at path: {scenePath}";
1451
+ return false;
1452
+ }
1453
+
1454
+ var scenes = new List<EditorBuildSettingsScene>(EditorBuildSettings.scenes);
1455
+ scenes.RemoveAll(s => string.Equals(s.path, scenePath, StringComparison.OrdinalIgnoreCase));
1456
+
1457
+ targetIndex = Mathf.Clamp(targetIndex, 0, scenes.Count);
1458
+
1459
+ var newScene = new EditorBuildSettingsScene(scenePath, true);
1460
+ scenes.Insert(targetIndex, newScene);
1461
+
1462
+ EditorBuildSettings.scenes = scenes.ToArray();
1463
+ return true;
1464
+ }
1465
+
1466
+
1469
1467
  private static string FormatBuildTime(System.DateTime buildTime)
1470
1468
  {
1471
1469
  System.TimeSpan timeSince = System.DateTime.Now - buildTime;
@@ -2168,7 +2166,7 @@ namespace Hyper.Editor
2168
2166
  /// </summary>
2169
2167
  private static void ForceAssetRepack()
2170
2168
  {
2171
- const string hyperLoaderScenePath = "Assets/HyperSDK/HyperLoader.unity";
2169
+ const string hyperLoaderScenePath = HyperConstants.HYPER_LOADER_SCENE_PATH;
2172
2170
  const string markerPrefix = "__HyperSDK_BuildMarker";
2173
2171
  if (IsSDKDeveloper()) HyperDebug.Log("ForceAssetRepack() called");
2174
2172
 
package/HyperLoader.unity CHANGED
@@ -1840,7 +1840,7 @@ MonoBehaviour:
1840
1840
  m_MinValue: 0
1841
1841
  m_MaxValue: 1
1842
1842
  m_WholeNumbers: 0
1843
- m_Value: 0.227
1843
+ m_Value: 0.065
1844
1844
  m_OnValueChanged:
1845
1845
  m_PersistentCalls:
1846
1846
  m_Calls: []
@@ -120,7 +120,7 @@ namespace Hyper.Internal
120
120
  {
121
121
  _dataManager.SetSound(_dataManager.GetSound() == 1 ? 0 : 1);
122
122
  soundIcon.sprite = _dataManager.GetSound() == 1 ? soundIconOn : soundIconOff;
123
- soundText.text = _dataManager.GetSound() == 1 ? "Sound ON" : "Sound OFF";
123
+ soundText.text = _dataManager.GetSound() == 1 ? "Sound On" : "Sound Off";
124
124
  }
125
125
 
126
126
  public void ShowTutorial()
@@ -37,6 +37,7 @@ namespace Hyper.Internal
37
37
  public const string SETTINGS_ASSET_PATH = "Assets/HyperSDK/Runtime/Resources/HyperSDKSettings.asset";
38
38
  public const string GAME_CONTENT_ASSET_PATH = "Assets/HyperSDK/Runtime/Resources/HyperGameContentConfig.asset";
39
39
  public const string RESOURCES_FOLDER_PATH = "Assets/HyperSDK/Runtime/Resources";
40
+ public const string HYPER_LOADER_SCENE_PATH = "Assets/HyperSDK/HyperLoader.unity";
40
41
 
41
42
  /// <summary>
42
43
  /// Returns the banner texture path, checking dev mode (Assets/) first, then package mode (Packages/).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "app.hypergames.hypersdk",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "displayName": "HyperSDK",
5
5
  "description": "Official Unity SDK for Hyper: multiplayer battles, leaderboards, deterministic RNG, session management, tutorials, and WebGL optimizations for production-ready games.",
6
6
  "unity": "6000.0",