app.hypergames.hypersdk 1.2.0 → 1.2.1
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 +7 -0
- package/Editor/Scripts/Utils/HyperSceneReferenceDrawer.cs +10 -2
- package/Editor/Scripts/Windows/HyperCoreSettingsWindow.cs +2 -5
- package/Editor/Scripts/Windows/HyperGameContentWindow.cs +1 -4
- package/Editor/Scripts/Windows/HyperSettingsWindow.cs +31 -10
- package/HyperLoader.unity +1 -1
- package/Runtime/Resources/HyperGameContentConfig.asset +6 -0
- package/Runtime/Shared/Utils/HyperSceneReference.cs +52 -36
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [1.2.1](https://github.com/mvmhyper/hyper-sdk/compare/v1.2.0...v1.2.1) (2025-11-26)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* stabilize scene references, installer overwrite, and resources path helper ([c27499e](https://github.com/mvmhyper/hyper-sdk/commit/c27499e525712d1fcf2f42e30813013e9610e254))
|
|
7
|
+
|
|
1
8
|
# [1.2.0](https://github.com/mvmhyper/hyper-sdk/compare/v1.1.11...v1.2.0) (2025-11-26)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -16,7 +16,10 @@ namespace Hyper.Editor
|
|
|
16
16
|
EditorGUI.BeginProperty(position, label, property);
|
|
17
17
|
|
|
18
18
|
SerializedProperty guidProperty = property.FindPropertyRelative("sceneGUID");
|
|
19
|
-
|
|
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
|
|
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
|
-
|
|
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.
|
|
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
|
-
|
|
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
|
-
|
|
113
|
-
{
|
|
114
|
-
AssetDatabase.CreateFolder("Assets", "Resources");
|
|
115
|
-
}
|
|
112
|
+
EnsureResourcesFolderExists();
|
|
116
113
|
|
|
117
114
|
var newSettings = CreateInstance<HyperSDKSettings>();
|
|
118
|
-
string assetPath = $"{HyperConstants.
|
|
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
|
-
|
|
133
|
-
{
|
|
134
|
-
AssetDatabase.CreateFolder("Assets", "Resources");
|
|
135
|
-
}
|
|
129
|
+
EnsureResourcesFolderExists();
|
|
136
130
|
|
|
137
131
|
var newConfig = CreateInstance<HyperGameContentConfig>();
|
|
138
|
-
string assetPath = $"{HyperConstants.
|
|
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:
|
|
888
|
+
m_Name: __HyperSDK_BuildMarker_638997386571830226
|
|
889
889
|
m_TagString: Untagged
|
|
890
890
|
m_Icon: {fileID: 0}
|
|
891
891
|
m_NavMeshLayer: 0
|
|
@@ -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
|
|
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
|
-
|
|
30
|
-
if (string.IsNullOrEmpty(
|
|
30
|
+
// In editor, keep sceneName in sync with GUID/path for clarity
|
|
31
|
+
if (!string.IsNullOrEmpty(sceneGUID))
|
|
31
32
|
{
|
|
32
|
-
|
|
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
|
|
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
|
-
|
|
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.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"displayName": "HyperSDK",
|
|
5
|
-
"description": "Official Unity SDK for
|
|
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://
|
|
29
|
-
"changelogUrl": "https://
|
|
30
|
-
"documentationUrl": "https://
|
|
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",
|