Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question switch case not updating Score counter

Discussion in 'Getting Started' started by MattBStar, Sep 14, 2023.

  1. MattBStar

    MattBStar

    Joined:
    Sep 9, 2023
    Posts:
    2
    I'm doing this switch/case to increment the playerScore depending on the animal that triggered the function, but in the Debug console it always return debug.log with 0 and a debug.log with the triggered animal score, but it never increments always return 0 and score. The score variable is private float if it helps. upload_2023-9-14_9-50-18.png
     

    Attached Files:

  2. ijmmai

    ijmmai

    Joined:
    Jun 9, 2023
    Posts:
    188
    You destroy the gameObject and then run a function that tries to compare the gameObject.name to a string.