I only noticed this testing saving and loading for mana, but it seems whenever I load my Action Bar items (in this case just the one item) doubles. So I get two the first load, four the second, and so on. Has anyone encountered this issue or know why it might be occurring?
https://www.udemy.com/course/rpg-shops-abilities/learn/lecture/26464558#questions/17227380
Quite common from the codebase used in the Shops & Abilities. Here’s the fix located inside the link
I appreciate the link but this seems to take me to a store page for the course with Udemy. I think I have the course directly through GameDev maybe? I didn’t see a way to get to the codebase without getting the course again.
Brian — Teaching AssistantAnswer
2 upvotes2
1 year ago
Hmm… you’re right, a single line was left out of ActionStore.RestoreState() that will remedy this,
at the beginning of RestoreState in ActionStore.cs, add this line:
- dockedItem.Clear();
As to the second issue, make sure that your image overlay for cooldown time has the RaycastTarget unchecked. It’s overtop the item, and if it’s RaycastTarget is checked, the item never gets the Drag messages.
This seems to give an error, if I am reading the change correctly
void ISaveable.RestoreState(object state)
{
dockedItem.Clear();///new code giving error
var stateDict = (Dictionary<int, DockedItemRecord>)state;
foreach (var pair in stateDict)
{
AddAction(InventoryItem.GetFromID(pair.Value.itemID), pair.Key, pair.Value.number);
}
}
Figured it out, it should be “dockedItems” with an “s” but otherwise that fix does seem to work. Thanks a lot!
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.