2

I'm facing a critical issue with syncing Zenject and StateMachine after dividing my game into multiple scenes. Previously, the game ran in a single scene with GRPC networking, but due to changes, I've removed GRPC and split the game into four separate scenes.

Unfortunately, this has resulted in broken Zenject bindings and disrupted the flow of the StateMachine when the BattleScene is loaded from Photon Fusion Server, rendering the gameplay non-functional.

Here's a clear description of the problem I'm encountering:

  1. Initially, the game had a StateMachine responsible for triggering various states within a flow, with Zenject bindings properly established.

  2. The networking was handled via GRPC, and the entire game ran in a single scene without any issues.

  3. I've removed GRPC and divided the game into four distinct scenes, one of which is the BattleScene loaded from the Fusion Server.

  4. However, upon loading the BattleScene, all Zenject bindings break, causing the StateMachine's flow to become unsynchronized.

Consequently, none of the gameplay functionalities are operational, making it impossible to utilize any game features.

My primary objective is to sync the StateMachine states from the last called state with the current state after the BattleScene is loaded from the server. Additionally, I need to restore all Zenject bindings to ensure the proper functioning of the game. As I'm unable to find a viable solution on my own. Any insights, ideas, or potential workarounds are appreciated.

James Z
  • 12,209
  • 10
  • 24
  • 44
Humza Butt
  • 44
  • 2
  • When transitioning between scenes, it's crucial to ensure that the StateMachine's current state is preserved. One possible approach is to have a dedicated script or object that manages the StateMachine and is not affected by scene changes. This script can handle saving and restoring the current state during scene transitions. – Brutal Jun 22 '23 at 11:36
  • Have you tried braking you code into main context and scene context? – VisDesign Jun 22 '23 at 20:31

0 Answers0