Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Can someone tell me why it doesnt update the money for a kill

Discussion in 'Editor & General Support' started by The_Ganti, Feb 11, 2021.

  1. The_Ganti

    The_Ganti

    Joined:
    Dec 5, 2020
    Posts:
    2
    I tried with another script where it was attached to the enemy prefab. But this didnt allow me to reference the canvas text "money" on the prefab because that doesnt work it seems. So now i have it attached to the player. Any solutions?
     

    Attached Files:

  2. max3210

    max3210

    Joined:
    Apr 19, 2020
    Posts:
    17
    It looks as if you're updating CurrentMoney after displaying it, and you should do it before. If you swap places for the last 2 lines of code that ought to fix it.