Forum begins after the advertisement:


[Part 28] SaveManager Instance not being set

Home Forums Video Game Tutorial Series Creating a Rogue-like Shoot-em Up in Unity [Part 28] SaveManager Instance not being set

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #19539
    Calum
    Level 12
    Silver Supporter (Patron)
    Helpful?
    Up
    0
    ::

    After testing at the end of section 3e, returned an error on the following line of code in the UIPowerSelector script:

    purchasedLevel = SaveManager.Instance.GetLevel(powerUp);

    Using debug I was able to rule out the error being in the ‘powerUp’ variable, instead SaveManager.Instance was still null.

    Further debugging in the SaveManager’s Awake() function shows me that the script isn’t being loaded at all.

    Unsure if I’ve missed something in the blog post, in the Bench user guide, or if there’s an object which SaveManager should be a component of in the scene.

    #19589
    Terence
    Level 32
    Keymaster
    Helpful?
    Up
    0
    ::

    Hi Calum, sorry I missed your post!

    Did you forget to attach the new SaveManager onto your scene? Without a copy of it there, the Awake() function will never run, so it will never get initialised.

    If it’s still not working, you can also follow this guide to set up a GitHub repo for your project, and I’ll hop in there to have a look at it for you.

    #19590
    Calum
    Level 12
    Silver Supporter (Patron)
    Helpful?
    Up
    1
    ::

    Hi Terence,

    I’ve added an empty game object to the scene now with a SaveManager component, and that seems to have done the trick. Thanks for the help!

      1 anonymous person
    has upvoted this post.
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Go to Login Page →


Advertisement below: