Shop items not appearing when Shop is first clicked

@sampattuzzi did you ever work out why the shop contents weren’t displaying the first time you click on a shop keeper?

I had a similar problem, and I think it was related to some residual persistent state (i.e. “savegame”) that was interfering, for reasons I don’t understand, possibly related to moving through the portal nearby. By deleting the save.sav file I found that my shop items were displaying on first click again.

The weird thing is that there is no serialized state handling on the Shop yet. Unfortunately I wasn’t able to debug it further because I haven’t yet been able to reproduce the issue again yet.

Maybe this helps someone if they have a similar issue.

That sounds like something in your save file might have been corrupted, and that crashed the shopkeeper.
These sorts of things are very difficult to nail down, as they’re not always reproduceable. For example, when I went through the videos and followed along with my own project, I never had this issue. Others did, but when they sent me the project to look at, it didn’t reproduce on my end.

It’s weird because closing the Shop dialog and then clicking again would bring up the correct list, and there were no errors in the log. It happened for both shopkeepers in my scene. I haven’t progressed far beyond this lecture myself either, so there’s not a lot of code involved yet.

Anyway, chalk it down to some unexplained temporary interaction I guess, and move on :slight_smile:

Ah, in lecture 22_SH_SAB Sam mentions this bug and it’s caused by the Scroll View’s Content object having a Quest List UI component attached, which destroys all the items in the Scroll view when it loses the race with ShopUI.RefreshUI().

The fact it was happening with my savegame was a red herring - in fact I was able to reproduce it again without the savegame involved. I must have fooled myself into thinking it was related when the race went in my favour a few times.

So the fix, as mentioned at the start of video 22_SH_SAB, is to remove the Quest List UI component from the Scroll View UI Component. Hope this helps future students.

I remember this now. I’d glossed it over because when I pulled my components for recycling, I stripped all the window specific UI code.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms