app.hypergames.hypersdk 1.11.0-beta.2 → 1.11.0-beta.3

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,11 @@
1
+ # [1.11.0-beta.3](https://github.com/mvmhyper/hyper-sdk/compare/v1.11.0-beta.2...v1.11.0-beta.3) (2026-08-28)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **replay:** reset random state before playback restart ([526a4d9](https://github.com/mvmhyper/hyper-sdk/commit/526a4d98c9b22241e3c52bb6837145bad999fb2b))
7
+ * **sample:** support lane runner custom restart ([49da385](https://github.com/mvmhyper/hyper-sdk/commit/49da385aaa917de438672a8630d4fe7927741b2a))
8
+
1
9
  # [1.11.0-beta.2](https://github.com/mvmhyper/hyper-sdk/compare/v1.11.0-beta.1...v1.11.0-beta.2) (2026-08-27)
2
10
 
3
11
 
@@ -20,6 +20,7 @@ namespace Hyper.Internal
20
20
 
21
21
  private static bool _isInitialized;
22
22
  private static bool _isSoftRestarting;
23
+ private static bool _replayRandomResetPending;
23
24
  private static bool _customLoadingComplete;
24
25
  private static bool _customLoadingActive;
25
26
  private static float _customLoadingProgress;
@@ -145,7 +146,8 @@ namespace Hyper.Internal
145
146
  _gameManager != null && _eventManager != null)
146
147
  {
147
148
  _replayManager?.PrepareForRestart();
148
- ResetReplayRandomState();
149
+ // Custom cleanup may use random streams. Rewind after cleanup, immediately before OnGameStart.
150
+ DeferReplayRandomReset();
149
151
  _gameManager.ResetUIStateForCustomRestart();
150
152
  _eventManager.InvokeCustomRestartEvent();
151
153
  _isSoftRestarting = false;
@@ -176,6 +178,19 @@ namespace Hyper.Internal
176
178
  HyperRandom.Init(ReplaySessionState.OriginalRandomSeed);
177
179
  }
178
180
 
181
+ internal static void ApplyPendingReplayRandomReset()
182
+ {
183
+ if (!_replayRandomResetPending) return;
184
+
185
+ _replayRandomResetPending = false;
186
+ ResetReplayRandomState();
187
+ }
188
+
189
+ internal static void DeferReplayRandomReset()
190
+ {
191
+ _replayRandomResetPending = true;
192
+ }
193
+
179
194
  /// <summary>
180
195
  /// Coroutine-based restart that properly unloads all scenes before reloading.
181
196
  /// Handles async scene operations and ensures clean state before restart.
@@ -414,6 +429,7 @@ namespace Hyper.Internal
414
429
  _customLoadingComplete = false;
415
430
  _customLoadingActive = false;
416
431
  _customLoadingProgress = 0f;
432
+ _replayRandomResetPending = false;
417
433
 
418
434
  if (_singletonObject != null)
419
435
  {
@@ -472,6 +488,7 @@ namespace Hyper.Internal
472
488
  _customLoadingComplete = false;
473
489
  _customLoadingActive = false;
474
490
  _customLoadingProgress = 0f;
491
+ _replayRandomResetPending = false;
475
492
  }
476
493
  }
477
494
  }
@@ -1025,6 +1025,8 @@ namespace Hyper.Internal.Managers
1025
1025
  if (_gameStartRequested || _hasGameStarted || _hasGameEnded || !IsInGameScene) return;
1026
1026
  _gameStartRequested = true;
1027
1027
 
1028
+ HyperRuntime.ApplyPendingReplayRandomReset();
1029
+
1028
1030
  HideStartGameDeadlineSnackBar();
1029
1031
  _dataManager.UpdateScore(0);
1030
1032
  HyperRuntime.Timer.StartActiveGameTimer();
@@ -1062,7 +1064,7 @@ namespace Hyper.Internal.Managers
1062
1064
 
1063
1065
  /// <summary>
1064
1066
  /// Resets SDK UI state for custom restart flow.
1065
- /// Called after OnCustomRestart event is fired to prepare the SDK for the developer's restart logic.
1067
+ /// Called before OnCustomRestart so the developer's cleanup starts from reset SDK state.
1066
1068
  /// </summary>
1067
1069
  internal void ResetUIStateForCustomRestart()
1068
1070
  {
@@ -491,7 +491,8 @@ MonoBehaviour:
491
491
  laneChangeSpeed: 14
492
492
  jumpVelocity: 7.5
493
493
  swipeThreshold: 45
494
- startPosition: {x: 3.62, y: 0.567, z: 0}
494
+ startPosition: {x: 3.62, y: 0.5, z: 0}
495
+ groundHeight: 0.5
495
496
  --- !u!54 &554141008
496
497
  Rigidbody:
497
498
  m_ObjectHideFlags: 0
@@ -574,7 +575,7 @@ BoxCollider:
574
575
  m_Material: {fileID: 0}
575
576
  m_IncludeLayers:
576
577
  serializedVersion: 2
577
- m_Bits: 0
578
+ m_Bits: 1
578
579
  m_ExcludeLayers:
579
580
  serializedVersion: 2
580
581
  m_Bits: 0
@@ -1051,7 +1052,7 @@ BoxCollider:
1051
1052
  m_Material: {fileID: 0}
1052
1053
  m_IncludeLayers:
1053
1054
  serializedVersion: 2
1054
- m_Bits: 0
1055
+ m_Bits: 1
1055
1056
  m_ExcludeLayers:
1056
1057
  serializedVersion: 2
1057
1058
  m_Bits: 0
@@ -54,7 +54,7 @@ SphereCollider:
54
54
  m_Material: {fileID: 0}
55
55
  m_IncludeLayers:
56
56
  serializedVersion: 2
57
- m_Bits: 0
57
+ m_Bits: 1
58
58
  m_ExcludeLayers:
59
59
  serializedVersion: 2
60
60
  m_Bits: 0
@@ -54,7 +54,7 @@ BoxCollider:
54
54
  m_Material: {fileID: 0}
55
55
  m_IncludeLayers:
56
56
  serializedVersion: 2
57
- m_Bits: 0
57
+ m_Bits: 1
58
58
  m_ExcludeLayers:
59
59
  serializedVersion: 2
60
60
  m_Bits: 0
@@ -13,13 +13,20 @@ deterministic spawning, a timed score multiplier, and replay integration.
13
13
  Assign `LaneRunnerSample` as the Game and Practice scene in Hyper Game Content
14
14
  Config, then use Hyper's Editor game-mode menu to run Practice, Battle, or Replay.
15
15
  Battle sessions record to `hyper-replay.ndjson` in `Application.persistentDataPath`.
16
+ Enable Custom Restart Flow in Hyper SDK Settings to test in-place Watch Again and
17
+ replay seeking without reloading the scene.
18
+
19
+ The sample uses only Unity's built-in `Default` layer, `Untagged`, and
20
+ `MainCamera`. Its collider overrides and ground safety do not require changes to
21
+ the importing project's tags, layers, or physics collision matrix.
16
22
 
17
23
  ## Integration structure
18
24
 
19
25
  - `LaneRunnerGame` owns rules, score, speed, and power-up state.
20
26
  - `LaneRunnerPlayer` owns physical input and applies commands in `FixedUpdate`.
21
27
  - `LaneRunnerSpawner` creates deterministic rows using `HyperRandom`.
22
- - `LaneRunnerTournamentAdapter` connects score, power-ups, and lifecycle to HyperSDK.
28
+ - `LaneRunnerTournamentAdapter` connects score, power-ups, lifecycle, and custom
29
+ restart handling to HyperSDK.
23
30
  - `LaneRunnerReplayAdapter` records accepted commands and injects replay commands
24
31
  through the same player path.
25
32
 
@@ -11,7 +11,8 @@ namespace HyperSamples.LaneRunner
11
11
  [SerializeField] private float laneChangeSpeed = 14f;
12
12
  [SerializeField] private float jumpVelocity = 7.5f;
13
13
  [SerializeField] private float swipeThreshold = 45f;
14
- [SerializeField] private Vector3 startPosition = new Vector3(0f, 0.68f, 0f);
14
+ [SerializeField] private Vector3 startPosition = new Vector3(0f, 0.5f, 0f);
15
+ [SerializeField] private float groundHeight = 0.5f;
15
16
 
16
17
  public event Action<LaneRunnerCommand> CommandApplied;
17
18
 
@@ -48,18 +49,18 @@ namespace HyperSamples.LaneRunner
48
49
 
49
50
  private void FixedUpdate()
50
51
  {
52
+ StabilizeGround();
53
+
51
54
  if (pendingLaneDelta != 0)
52
55
  {
53
56
  int nextLane = Mathf.Clamp(targetLane + pendingLaneDelta, -1, 1);
54
57
  pendingLaneDelta = 0;
55
- Debug.Log($"LaneRunnerPlayer: Moving from lane {targetLane} to {nextLane}");
56
58
  if (nextLane != targetLane)
57
59
  {
58
60
  LaneRunnerCommand applied = nextLane < targetLane
59
61
  ? LaneRunnerCommand.MoveLeft
60
62
  : LaneRunnerCommand.MoveRight;
61
63
  targetLane = nextLane;
62
- Debug.Log($"targetLane updated to {targetLane}");
63
64
  CommandApplied?.Invoke(applied);
64
65
  }
65
66
  }
@@ -120,7 +121,20 @@ namespace HyperSamples.LaneRunner
120
121
 
121
122
  private bool IsGrounded()
122
123
  {
123
- return body.position.y <= 0.68f && body.linearVelocity.y <= 0.05f;
124
+ return body.position.y <= groundHeight + 0.18f && body.linearVelocity.y <= 0.05f;
125
+ }
126
+
127
+ private void StabilizeGround()
128
+ {
129
+ if (body.position.y >= groundHeight || body.linearVelocity.y > 0f) return;
130
+
131
+ Vector3 position = body.position;
132
+ position.y = groundHeight;
133
+ body.position = position;
134
+
135
+ Vector3 velocity = body.linearVelocity;
136
+ velocity.y = 0f;
137
+ body.linearVelocity = velocity;
124
138
  }
125
139
 
126
140
  private void ReadTouchInput()
@@ -61,7 +61,9 @@ namespace HyperSamples.LaneRunner
61
61
  {
62
62
  for (int i = activeItems.Count - 1; i >= 0; i--)
63
63
  {
64
- if (activeItems[i] != null) Destroy(activeItems[i].gameObject);
64
+ if (activeItems[i] == null) continue;
65
+ activeItems[i].gameObject.SetActive(false);
66
+ Destroy(activeItems[i].gameObject);
65
67
  }
66
68
  activeItems.Clear();
67
69
  }
@@ -16,6 +16,7 @@ namespace HyperSamples.LaneRunner
16
16
  {
17
17
  HyperSDK.Event.OnGameStart += HandleGameStart;
18
18
  HyperSDK.Event.OnGameEnded += HandleGameEnded;
19
+ HyperSDK.Event.OnCustomRestart += HandleCustomRestart;
19
20
  game.ScoreChanged += HandleScoreChanged;
20
21
  game.DoubleScoreChanged += HandleDoubleScoreChanged;
21
22
  game.GameOverRequested += HandleGameOverRequested;
@@ -25,6 +26,7 @@ namespace HyperSamples.LaneRunner
25
26
  {
26
27
  HyperSDK.Event.OnGameStart -= HandleGameStart;
27
28
  HyperSDK.Event.OnGameEnded -= HandleGameEnded;
29
+ HyperSDK.Event.OnCustomRestart -= HandleCustomRestart;
28
30
  game.ScoreChanged -= HandleScoreChanged;
29
31
  game.DoubleScoreChanged -= HandleDoubleScoreChanged;
30
32
  game.GameOverRequested -= HandleGameOverRequested;
@@ -35,6 +37,11 @@ namespace HyperSamples.LaneRunner
35
37
  game.Begin(!HyperSDK.Game.IsReplayMode);
36
38
  }
37
39
 
40
+ private void HandleCustomRestart()
41
+ {
42
+ game.Stop();
43
+ }
44
+
38
45
  private void HandleGameEnded()
39
46
  {
40
47
  game.Stop();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "app.hypergames.hypersdk",
3
- "version": "1.11.0-beta.2",
3
+ "version": "1.11.0-beta.3",
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",