Forum begins after the advertisement:

 


[Part 8] How to let each health and mana orbs call once only in the game

Home Forums Video Game Tutorial Series Creating a Metroidvania in Unity [Part 8] How to let each health and mana orbs call once only in the game

Viewing 6 posts - 41 through 46 (of 46 total)
  • Author
    Posts
  • #15033
    Joseph Tang
    Level 13
    Moderator
    Helpful?
    Up
    0
    ::

    Your collectibles not reappearing after setting to new game means that the data for pickups is not being reset correctly.

    Check point [2] of my latest comment here.

    [Part 7] How can I let the game have “new game”

    It seems like someone else had an issue where they’re data was not being deleted appropriately. This code seeks to not only delete the file paths, but also reset all the variables in the SaveData.cs that is being loaded.

    If the code in [2], with some modifications to include your pickup variables, helped fix the issue, this would confirm that althought the save file is being deleted, the cached data for the variables are not. And they are only reset when you reopen your Unity Editor.

    #15034
    Elvin Sim
    Level 10
    Participant
    Helpful?
    Up
    0
    ::

    Still cannot, I try to use used = true or canvasUI.SetActive(true) to the ResetPickupData(), and it come out this error, by the way I use SaveDataManager to delete data not DeleteAllSaveData()

    View post on imgur.com
    #15035
    Elvin Sim
    Level 10
    Participant
    Helpful?
    Up
    0
    ::

    you can write the code to help me, because I don’t know how to fix it alr T_T

    #15036
    Joseph Tang
    Level 13
    Moderator
    Helpful?
    Up
    0
    ::

    Please follow what is being done in the above post instead.

    You cannot change the the Instance of your pickups when they have not been instantiated. Furthermore, setting the pickup’s bool used to true only makes them unable to be picked up.

    This also does not solve the issue since the problem may possibly only lie in the SaveData.cs retaining the information of collectedPickups until the Unity Editor is closed.


    Instead of trying to reset the pickup scripts through your SaveDataManager.cs just instantiate the SaveData.Instance from the method instead, then try deleting the relevant information from there.

    SaveDataManager.cs

        public void ResetPickupData()
        {
            SaveData.Instance.Initialize();
            SaveData.Instance.collectedPickups.Clear();
        }
    #15037
    Elvin Sim
    Level 10
    Participant
    Helpful?
    Up
    0
    ::

    Thank you very muchhhhhhhhhhhhhhhh!!!!!!!!!!!!!!

    #15038
    Elvin Sim
    Level 10
    Participant
    Helpful?
    Up
    0
    ::

    It fix

Viewing 6 posts - 41 through 46 (of 46 total)
  • You must be logged in to reply to this topic.

Go to Login Page →


Advertisement below: