mikdog

Player start AC

Jan 8th, 2025
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.28 KB | None | 0 0
  1. In Adventure Creator for Unity, saving and loading the player’s current position (instead of always starting at the PlayerStart marker) is a built-in feature. Here’s how you can achieve it:
  2.  
  3. Steps:
  4. 1. Ensure Player Position is Included in Save Data:
  5. Adventure Creator automatically saves the player’s position by default when saving a game. To ensure this, make sure the player prefab is correctly set up:
  6. • Open the Scene Settings in the Adventure Creator Game Editor.
  7. • Check that the Default Player is assigned in the Settings Manager.
  8. • Confirm that your player prefab is marked as Player in the Player prefab field of the Settings Manager.
  9. 2. Set Up PlayerStart for Default Entry:
  10. • The PlayerStart marker will only be used when starting a new game or when the player’s position isn’t stored (e.g., entering the scene from another one). If you want to ensure it’s bypassed when loading, don’t force the scene to respawn the player at PlayerStart.
  11. 3. Configure Save and Load Settings:
  12. • Navigate to Settings Manager > Save Game Options.
  13. • Confirm that “Save scene-specific player position?” is enabled. This ensures that the player’s exact position and rotation are saved and restored when loading a game.
  14. 4. Ensure Correct Scene Loading:
  15. • When loading a saved game, ensure that your Load system is set up correctly:
  16. • Use Adventure Creator’s built-in Save/Load menus or call the SaveSystem.LoadGame function through scripting or actions.
  17. • This will load the player’s saved position along with other game data.
  18. 5. Testing:
  19. • Save your game using a save action or the in-game menu while the player is at a specific position.
  20. • Load the saved game and confirm that the player spawns at the saved position instead of the PlayerStart.
  21.  
  22. Troubleshooting:
  23. • If the player still starts at the PlayerStart marker after loading:
  24. • Verify that your player prefab’s Remember Transform component is attached and enabled.
  25. • Ensure the player object in the hierarchy matches the player prefab assigned in the Settings Manager.
  26. • Confirm that the correct save file is being loaded.
  27.  
  28. By following these steps, the player’s current position should be saved and restored properly, allowing seamless continuation from where the player left off.
Advertisement
Add Comment
Please, Sign In to add comment