app.hypergames.hypersdk 1.2.0 → 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,17 @@
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
+
8
+ ## [1.2.1](https://github.com/mvmhyper/hyper-sdk/compare/v1.2.0...v1.2.1) (2025-11-26)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * stabilize scene references, installer overwrite, and resources path helper ([c27499e](https://github.com/mvmhyper/hyper-sdk/commit/c27499e525712d1fcf2f42e30813013e9610e254))
14
+
1
15
  # [1.2.0](https://github.com/mvmhyper/hyper-sdk/compare/v1.1.11...v1.2.0) (2025-11-26)
2
16
 
3
17
 
@@ -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
 
@@ -16,7 +16,10 @@ namespace Hyper.Editor
16
16
  EditorGUI.BeginProperty(position, label, property);
17
17
 
18
18
  SerializedProperty guidProperty = property.FindPropertyRelative("sceneGUID");
19
- if (guidProperty == null)
19
+ SerializedProperty pathProperty = property.FindPropertyRelative("scenePath");
20
+ SerializedProperty nameProperty = property.FindPropertyRelative("sceneName");
21
+
22
+ if (guidProperty == null || pathProperty == null || nameProperty == null)
20
23
  {
21
24
  EditorGUI.LabelField(position, label.text, "HyperSceneReference: Invalid property structure");
22
25
  EditorGUI.EndProperty();
@@ -44,18 +47,23 @@ namespace Hyper.Editor
44
47
  false
45
48
  ) as SceneAsset;
46
49
 
47
- // Update GUID if scene changed
50
+ // Update serialized values if scene changed
48
51
  if (newScene != currentScene)
49
52
  {
50
53
  if (newScene != null)
51
54
  {
52
55
  string newPath = AssetDatabase.GetAssetPath(newScene);
53
56
  string newGUID = AssetDatabase.AssetPathToGUID(newPath);
57
+ string newName = System.IO.Path.GetFileNameWithoutExtension(newPath);
54
58
  guidProperty.stringValue = newGUID;
59
+ pathProperty.stringValue = newPath;
60
+ nameProperty.stringValue = newName;
55
61
  }
56
62
  else
57
63
  {
58
64
  guidProperty.stringValue = string.Empty;
65
+ pathProperty.stringValue = string.Empty;
66
+ nameProperty.stringValue = string.Empty;
59
67
  }
60
68
  }
61
69
 
@@ -78,14 +78,11 @@ namespace Hyper.Editor
78
78
  private void CreateSettingsAsset()
79
79
  {
80
80
  // Ensure Resources folder exists
81
- if (!AssetDatabase.IsValidFolder(HyperConstants.RESOURCES_FOLDER_PATH))
82
- {
83
- AssetDatabase.CreateFolder("Assets", "Resources");
84
- }
81
+ HyperSettingsWindow.EnsureResourcesFolderExists();
85
82
 
86
83
  // Create settings asset
87
84
  var newSettings = CreateInstance<HyperSDKSettings>();
88
- string assetPath = $"{HyperConstants.RESOURCES_FOLDER_PATH}/HyperSDKSettings.asset";
85
+ string assetPath = $"{HyperConstants.SETTINGS_ASSET_PATH}";
89
86
 
90
87
  AssetDatabase.CreateAsset(newSettings, assetPath);
91
88
  AssetDatabase.SaveAssets();
@@ -76,10 +76,7 @@ namespace Hyper.Editor
76
76
  private void CreateConfigAsset()
77
77
  {
78
78
  // Ensure Resources folder exists
79
- if (!AssetDatabase.IsValidFolder(HyperConstants.RESOURCES_FOLDER_PATH))
80
- {
81
- AssetDatabase.CreateFolder("Assets", "Resources");
82
- }
79
+ HyperSettingsWindow.EnsureResourcesFolderExists();
83
80
 
84
81
  // Create config asset
85
82
  var newConfig = CreateInstance<HyperGameContentConfig>();
@@ -109,13 +109,10 @@ namespace Hyper.Editor
109
109
 
110
110
  private void CreateSettingsAsset()
111
111
  {
112
- if (!AssetDatabase.IsValidFolder(HyperConstants.RESOURCES_FOLDER_PATH))
113
- {
114
- AssetDatabase.CreateFolder("Assets", "Resources");
115
- }
112
+ EnsureResourcesFolderExists();
116
113
 
117
114
  var newSettings = CreateInstance<HyperSDKSettings>();
118
- string assetPath = $"{HyperConstants.RESOURCES_FOLDER_PATH}/HyperSDKSettings.asset";
115
+ string assetPath = $"{HyperConstants.SETTINGS_ASSET_PATH}";
119
116
 
120
117
  AssetDatabase.CreateAsset(newSettings, assetPath);
121
118
  AssetDatabase.SaveAssets();
@@ -129,13 +126,10 @@ namespace Hyper.Editor
129
126
 
130
127
  private void CreateConfigAsset()
131
128
  {
132
- if (!AssetDatabase.IsValidFolder(HyperConstants.RESOURCES_FOLDER_PATH))
133
- {
134
- AssetDatabase.CreateFolder("Assets", "Resources");
135
- }
129
+ EnsureResourcesFolderExists();
136
130
 
137
131
  var newConfig = CreateInstance<HyperGameContentConfig>();
138
- string assetPath = $"{HyperConstants.RESOURCES_FOLDER_PATH}/HyperGameContentConfig.asset";
132
+ string assetPath = $"{HyperConstants.GAME_CONTENT_ASSET_PATH}";
139
133
 
140
134
  AssetDatabase.CreateAsset(newConfig, assetPath);
141
135
  AssetDatabase.SaveAssets();
@@ -287,6 +281,33 @@ namespace Hyper.Editor
287
281
  }
288
282
 
289
283
  #endregion
284
+ internal static void EnsureResourcesFolderExists()
285
+ {
286
+ if (AssetDatabase.IsValidFolder(HyperConstants.RESOURCES_FOLDER_PATH))
287
+ {
288
+ return;
289
+ }
290
+
291
+ string[] segments = HyperConstants.RESOURCES_FOLDER_PATH.Split('/');
292
+ if (segments.Length == 0)
293
+ {
294
+ return;
295
+ }
296
+
297
+ string currentPath = segments[0]; // "Assets"
298
+ for (int i = 1; i < segments.Length; i++)
299
+ {
300
+ string folderName = segments[i];
301
+ string nextPath = $"{currentPath}/{folderName}";
302
+
303
+ if (!AssetDatabase.IsValidFolder(nextPath))
304
+ {
305
+ AssetDatabase.CreateFolder(currentPath, folderName);
306
+ }
307
+
308
+ currentPath = nextPath;
309
+ }
310
+ }
290
311
  }
291
312
  }
292
313
  #endif
package/HyperLoader.unity CHANGED
@@ -885,7 +885,7 @@ GameObject:
885
885
  m_Component:
886
886
  - component: {fileID: 1064166296}
887
887
  m_Layer: 0
888
- m_Name: __HyperSDK_BuildMarker_638996587933635093
888
+ m_Name: __HyperSDK_BuildMarker_638997386571830226
889
889
  m_TagString: Untagged
890
890
  m_Icon: {fileID: 0}
891
891
  m_NavMeshLayer: 0
@@ -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/).
@@ -14,9 +14,15 @@ MonoBehaviour:
14
14
  m_EditorClassIdentifier:
15
15
  GameScene:
16
16
  sceneGUID:
17
+ scenePath:
18
+ sceneName:
17
19
  PracticeScene:
18
20
  sceneGUID:
21
+ scenePath:
22
+ sceneName:
19
23
  PracticeSceneType: 0
20
24
  TransitionScene:
21
25
  sceneGUID:
26
+ scenePath:
27
+ sceneName:
22
28
  gamePosterSprite: {fileID: 0}
@@ -8,75 +8,69 @@ namespace Hyper.Shared
8
8
  /// Allows drag-and-drop scene assignment in the inspector without external dependencies.
9
9
  /// </summary>
10
10
  [Serializable]
11
- public class HyperSceneReference
11
+ public class HyperSceneReference : ISerializationCallbackReceiver
12
12
  {
13
13
  [SerializeField]
14
14
  private string sceneGUID;
15
15
 
16
+ [SerializeField]
17
+ private string scenePath;
18
+
19
+ [SerializeField]
20
+ private string sceneName;
21
+
16
22
  /// <summary>
17
- /// Gets the scene name from the GUID, or null if invalid.
23
+ /// Gets the scene name stored at serialization time.
18
24
  /// </summary>
19
25
  public string SceneName
20
26
  {
21
27
  get
22
28
  {
23
- if (string.IsNullOrEmpty(sceneGUID))
24
- {
25
- return null;
26
- }
27
-
28
29
  #if UNITY_EDITOR
29
- string assetPath = UnityEditor.AssetDatabase.GUIDToAssetPath(sceneGUID);
30
- if (string.IsNullOrEmpty(assetPath))
30
+ // In editor, keep sceneName in sync with GUID/path for clarity
31
+ if (!string.IsNullOrEmpty(sceneGUID))
31
32
  {
32
- return null;
33
+ string assetPath = UnityEditor.AssetDatabase.GUIDToAssetPath(sceneGUID);
34
+ if (!string.IsNullOrEmpty(assetPath))
35
+ {
36
+ string fileName = System.IO.Path.GetFileNameWithoutExtension(assetPath);
37
+ if (!string.IsNullOrEmpty(fileName))
38
+ {
39
+ sceneName = fileName;
40
+ scenePath = assetPath;
41
+ }
42
+ }
33
43
  }
34
-
35
- // Extract scene name from path (e.g., "Assets/Scenes/MyScene.unity" -> "MyScene")
36
- string sceneName = System.IO.Path.GetFileNameWithoutExtension(assetPath);
37
- return sceneName;
38
- #else
39
- // In builds, we can't resolve GUIDs, so return null
40
- return null;
41
44
  #endif
45
+ return sceneName;
42
46
  }
43
47
  }
44
48
 
49
+ /// <summary>
50
+ /// Gets the scene path stored at serialization time.
51
+ /// </summary>
52
+ public string ScenePath => scenePath;
53
+
45
54
  /// <summary>
46
55
  /// Gets the scene GUID.
47
56
  /// </summary>
48
57
  public string GUID => sceneGUID;
49
58
 
50
59
  /// <summary>
51
- /// Returns true if the scene reference is valid (has a GUID and resolves to a scene).
60
+ /// Returns true if the scene reference has valid serialized data.
52
61
  /// </summary>
53
62
  public bool IsValid
54
63
  {
55
64
  get
56
65
  {
57
- if (string.IsNullOrEmpty(sceneGUID))
58
- {
59
- return false;
60
- }
61
-
62
- #if UNITY_EDITOR
63
- string assetPath = UnityEditor.AssetDatabase.GUIDToAssetPath(sceneGUID);
64
- if (string.IsNullOrEmpty(assetPath))
65
- {
66
- return false;
67
- }
68
-
69
- // Check if it's actually a scene file
70
- return assetPath.EndsWith(".unity", System.StringComparison.OrdinalIgnoreCase);
71
- #else
72
- // In builds, assume valid if GUID exists (can't verify without AssetDatabase)
73
- return true;
74
- #endif
66
+ return !string.IsNullOrEmpty(sceneGUID) &&
67
+ !string.IsNullOrEmpty(sceneName);
75
68
  }
76
69
  }
77
70
 
78
71
  /// <summary>
79
72
  /// Implicit conversion to string for backward compatibility.
73
+ /// Returns the stored scene name.
80
74
  /// </summary>
81
75
  public static implicit operator string(HyperSceneReference sceneRef)
82
76
  {
@@ -90,6 +84,28 @@ namespace Hyper.Shared
90
84
  {
91
85
  return SceneName ?? string.Empty;
92
86
  }
87
+
88
+ #if UNITY_EDITOR
89
+ public void OnBeforeSerialize()
90
+ {
91
+ if (!string.IsNullOrEmpty(sceneGUID))
92
+ {
93
+ string assetPath = UnityEditor.AssetDatabase.GUIDToAssetPath(sceneGUID);
94
+ if (!string.IsNullOrEmpty(assetPath))
95
+ {
96
+ scenePath = assetPath;
97
+ sceneName = System.IO.Path.GetFileNameWithoutExtension(assetPath);
98
+ }
99
+ }
100
+ }
101
+
102
+ public void OnAfterDeserialize()
103
+ {
104
+ }
105
+ #else
106
+ public void OnBeforeSerialize() { }
107
+ public void OnAfterDeserialize() { }
108
+ #endif
93
109
  }
94
110
  }
95
111
 
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "app.hypergames.hypersdk",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "displayName": "HyperSDK",
5
- "description": "Official Unity SDK for HyperGames. Brings platform APIs, multiplayer battle flow, score and tutorial systems, and WebGL build tooling straight into your project.",
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",
7
7
  "unityRelease": "0b5",
8
8
  "keywords": [
@@ -25,9 +25,9 @@
25
25
  "email": "info@mvm.gg",
26
26
  "url": "https://mvm.gg/"
27
27
  },
28
- "licensesUrl": "https://github.com/mvmhyper/hyper-sdk/blob/main/LICENSE.md",
29
- "changelogUrl": "https://github.com/mvmhyper/hyper-sdk/blob/main/CHANGELOG.md",
30
- "documentationUrl": "https://docs.hypergames.app/",
28
+ "licensesUrl": "https://mvm.gg/",
29
+ "changelogUrl": "https://mvm.gg/",
30
+ "documentationUrl": "https://mvm.gg/",
31
31
  "repository": {
32
32
  "type": "git",
33
33
  "url": "https://github.com/mvmhyper/hyper-sdk.git",