Giter Site home page Giter Site logo

Comments (5)

outfrost avatar outfrost commented on August 13, 2024

Hi,

Edited your message for better readability.

Could you please say, in what situation you encountered the error? A list of steps to reproduce it would be great.

I have to say, I will probably not have much free time at the moment to debug this project, but I'll try to help. If you happen to find a fix yourself, PRs are welcome!

Thanks!

from deckswipe.

legend1923 avatar legend1923 commented on August 13, 2024

Hi , Thank you .
First I downloaded from Github
I tried to open it with Unity 2019.2.12
I fixed GoogleSheet api and i try only run this codes.
GoogleSheet and Card model okey because its says 200. But then i see

NullReferenceException: Object reference not set to an instance of an object
DeckSwipe.Gamestate.GameProgress.AttachReferences (DeckSwipe.Gamestate.CardStorage cardStorage) (at Assets/DeckSwipe/Gamestate/GameProgress.cs:24)

Thanks

image

from deckswipe.

outfrost avatar outfrost commented on August 13, 2024

I think I have identified the problem.

You've only just started working with the project, so, most likely, you don't have the progress persistence file yet. The game attempts to locate the file at Application.persistentDataPath + "/progress.json". On Linux, that's ~/.config/unity3d/GruzWorks/DeckSwipe/progress.json. On Windows, it's going to be somewhere under AppData in your user directory.

That is perfectly normal, and the expected behaviour is that the game would just create a new, fresh GameProgress structure for you, and then save it whenever it would usually save your progress.

However, I missed a detail in the implementation. When the file doesn't exist, ProgressStorage gets a null from await LoadLocally(); on this line. It then notices that, and creates a new GameProgress. The next step is to call AttachReferences() on it. At the very beginning of that method, we try iterating over a list:

		public void AttachReferences(CardStorage cardStorage) {
			foreach (CardProgress entry in cardProgress) {

But we haven't initialised that list! So foreach wants to get an iterator from a list object that doesn't exist.

What's missing is a default constructor for GameProgress that would initialise the lists, or a = new List<...>() in the declaration of each. This is a very simple fix, so if you want to, you're more than welcome to fork the repository, implement the fix, and submit a pull request. If not, I'll probably provide the fix myself, but it might take longer until it's available, because I'm a bit busy.

Thank you for the report!

from deckswipe.

dastevens05 avatar dastevens05 commented on August 13, 2024

Hi,
Was there a fix provided for this by chance? I'm a novice here; managed to get through the Google API items, but stuck at this step without technical acumen to implement solution from scratch. Any more pointers? Thank you.

from deckswipe.

outfrost avatar outfrost commented on August 13, 2024

I have just pushed the fix, in commit f2c0388. The project should run out of the box now.

from deckswipe.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.