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

Question How to check if the player has finished the objective.

Discussion in 'Scripting' started by Corrothon, Apr 24, 2021.

  1. Corrothon

    Corrothon

    Joined:
    Jun 11, 2019
    Posts:
    60
    Okay, I'm working on this game where the player has to collect some stuff before being able to move to the next level, but I can't find anything online on it so yeah, if you could help that'd be epic.
     
  2. Realspawn1

    Realspawn1

    Joined:
    Jun 8, 2015
    Posts:
    126
    Use float variables. Say you need to pick up 6 keys than the float named keys should be set to 6 before going to a next level. Every time you pick up a key you can enter 1 to the key variable.

    If(key == 6){

    load the next level.



    Level change,picking up stuff, adding point to variables can be found at my place.
     
    Corrothon likes this.
  3. Corrothon

    Corrothon

    Joined:
    Jun 11, 2019
    Posts:
    60
    Thank you so much, Really appreciate it!
     
  4. Realspawn1

    Realspawn1

    Joined:
    Jun 8, 2015
    Posts:
    126
    Np just take the time to learn and figure out stuff. variables are used for many things there just like a box to put stuff in and get stuff out whenever you need them.

     
    Corrothon likes this.