Forum begins after the advertisement:


2 issues after part 11

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #12017
    Pavel Fára
    Participant

    Heloo i have 2 issues after part 11. I changed player sprite to my own sprite (with animations), adjusted scale, colliders and rigidbody for player and also increased radius of collector.
    But 2 issues apeared (no erros in code or console)
    Issue 1:
    When i pick up exp gems i dont get experience (worked fine before changing sprite)

    Issue 2
    Magnet stopped working completely. (worked fine before changing sprite)

    I havent done any changes to the code only changed sprite.
    Any tips?

    #12022
    Terence
    Keymaster

    Hi Pavel,

    Double check to make sure that all the player components like PlayerStats, InventoryManager, etc. and child GameObjects like the player collector are there.

    If you are still unable to find the issue, will you be able to upload a video to illustrate this? In the video, select your player character and make sure the inspector for your player GameObject is showing.

    #12027
    Pavel Fára
    Participant

    Wasnt able to record. Here are screenshots. The code looks fine to me.

    Player:

    Collector:

    #12035
    Pavel Fára
    Participant

    I checked the code and everythings look ok.

    here i images because i wasnt able to record a video.

    Player:

    Collector:

    <script async src=”//s.imgur.com/min/embed.js” charset=”utf-8″></script>

    #12036
    Pavel Fára
    Participant

    Hi, sadly when i embed images from imagur the reply wont post.

    #12068
    Terence
    Keymaster

    Hi Pavel, I’ve unflagged your post from spam, but it seems like the images are not found, so they don’t appear properly. Can you try uploading the images to Imgur again?

    #12072
    Pavel Fára
    Participant

    Hi thanks i managed to fix the problems myself.

    for Error 1: the experience wroked but i wasnt updating the experienceBar on every pick up of expGem

    For Error 2: Magnet stopped working because of animation on pickups. i fixed it by disabling the animation script when players colllider collides with pickup collider code: collision.gameObject.GetComponent<PickUpAnimation>().enabled = false;

    #12073
    Pavel Fára
    Participant

    Hi i dont know if to satrt new post or i can post here but i got 1 more issue, that i am unable to solve myself. i get NullReferenceException when player levelsup (upgrade screen shows only 1 option without set values) when i click the error it sends me to GameManager script to

     public void StartLevelUp()
    {
        ChangeState(GameState.LevelUp);
        playerObject.SendMessage("RemoveAndApplyUpgrades");
    }

    the issue beign the:

    playerObject.SendMessage("RemoveAndApplyUpgrades");

    #12128
    Terence
    Keymaster

    Hi Pavel, sorry I missed your other question. Whenever you see a NullReferenceException, you want to look at the objects you are accessing the properties of. In this case, the error is probably caused by:

    public void StartLevelUp()
    {
        ChangeState(GameState.LevelUp);
        playerObject.SendMessage("RemoveAndApplyUpgrades");
    }

    So I would do a print on playerObject to see if it is null:

    public void StartLevelUp()
    {
        ChangeState(GameState.LevelUp);
        print(playerObject);
        playerObject.SendMessage("RemoveAndApplyUpgrades");
    }

    If it is, you have to figure out why it is null. You can check the Inspector as you play the game to see when / why the variable becomes null.

    #12025
    Pavel Fára
    Participant

    Checked and it looks fine. Wanst able to make videos but here are screens of everything from player object and its child collector.

    Player:
    https://imgur.com/ez7svmy

    https://imgur.com/qDTLNC8

    Collector:
    https://imgur.com/TQsCxAw

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.

Go to Login Page →


Advertisement below: