Hello,
I have started developing my game for consoles (PS, Xbox, and Nintendo Switch) and am currently testing the builds on the dev kits.
When running the game on Xbox, it crashes after the splash screen (the same happens on Nintendo Switch). The game starts with a simple scene that has the AC.MainCamera
script attached to it.
According to the logs, the game attempts to retrieve the SettingsManager from the References asset, but it fails to load it from Resources.
SettingsManager
is located in the Resources
folder.
References is located in AdventureCreator/Resources
.
This build is already working on UWP for Desktop, so I guess it's something related to how Xbox references the assets.
Here are the logs:
The referenced script on this Behaviour (Game Object '<null>') is missing!
UnityEngine.ResourcesAPI:Load(String, Type) (at C:\build\output\unity\unity\Runtime\Export\Resources\Resources.bindings.cs:71)
UnityEngine.Resources:Load(String, Type) (at C:\build\output\unity\unity\Runtime\Export\Resources\Resources.bindings.cs:122)
AC.Resource:get_References() (at E:\Plot of the Druid\Assets\AdventureCreator\Scripts\Static\Resource.cs:99)
AC.AdvGame:GetReferences() (at E:\Plot of the Druid\Assets\AdventureCreator\Scripts\Static\AdvGame.cs:133)
AC.KickStarter:get_settingsManager() (at E:\Plot of the Druid\Assets\AdventureCreator\Scripts\Game engine\KickStarter.cs:357)
AC.MainCamera:SetAspectRatio() (at E:\Plot of the Druid\Assets\AdventureCreator\Scripts\Camera\MainCamera.cs:2221)
AC.MainCamera:RecalculateRects() (at E:\Plot of the Druid\Assets\AdventureCreator\Scripts\Camera\MainCamera.cs:353)
AC.MainCamera:Start() (at E:\Plot of the Druid\Assets\AdventureCreator\Scripts\Camera\MainCamera.cs:181)
Any suggestions?
AC version: 1.76
Unity version: 2022.3.38f1
Target Platform: UWP Xbox
Thanks!
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
SettingsManager doesn't need to be in Resources - only the References file, which should have the Managers assigned in its Inspector.
There shouldn't be an issue retrieving Resources on Xbox, but it is possible to assign the References asset manually through code, avoiding the need to load it through resources.
Try using this script in your game's first scene:
It solved the issue and not crush on the references on both Xbox and Nintendo Switch, thank you!
Now on Nintendo Switch, I encounter an issue with save files.
I've read in the forum that PlayerPrefs are supported and according to the log it looks like the game create them successfully with the message "PlayerPrefs key saved", but it also attempt to create directory and failed.
Here's the logs:
Here's call stack when attaching debugger:
https://imgur.com/a/exPXSw7
It looks like it tries to reach PersistentDataPath which might be the issue.
Any suggestion how to change the location?
AC version: 1.76
Unity version: 2022.3.38f1
Target Platform: Nintendo Switch
You need to rely on PlayerPrefs for your save files. At the moment, only Options data is being stored in PlayerPrefs.
See the Manual's "Custom save formats and handling" chapter for details on how to switch over to SaveFileHandler_PlayerPrefs.
According to the manual, I've called this:
SaveSystem.SaveFileHandler = new CustomSaveFileHandler();
where CustomSaveFileHandler inherits from SaveFileHandler_PlayerPrefs, and it solved the problem. Thank you!