Hi Chris,
I am facing an issue with save/load that maybe you can assist with.
I have an inventory item "Diary" that calls an asset (action) to open and close diary.
Because I need to query the Diary UI object and Unity doesn't let me query inactive objects I make the menu active on start but with a Canvas Group and alpha 0.
Then my action acts as a toggle that toggles between an alpha 0 and 1 effectively hiding and showing my diary. Great.
The issue is that for some reason when I load a game, the Diary appears as inactive. I have no idea why that is since nothing from my side is inactivating that object.
Do you have any idea why this might be happening? Is there anything that inactivates a menu on load game in AC?
Cheers,
Comments
AC will disable/enable linked UI Canvases upon loading according to their internal "on" state. So if a Menu is considered "off", but you've manually enabled it, then AC will still believe it to be off and will have it disabled after loading.
What is its Appear type set to? Try setting it to Manual and checking Enabled on start?. Alternatively, you could hook into the PostLoad call and manually enable it again.
AC wants to disable the Canvas of any inactive Menus, but you're instead keeping it on and making it invisible.
Game dev inevitably relies on the odd hack, so I wouldn't be too concerned about it - but if you want to really make it "best practice" then I'd suggest moving whatever data you're referring to in the UI onto a separate GameObject so that you can read it regardless of the Canvas's enabled state.