How can I trigger a cutscene after a certain amount of points is reached?

Hello! I am new to game development and code, so I am kind of lost here. I’m making a Flappy Bird-ish game and after the player reaches a certain amount of points, let’s say 50, I want a cutscene to be played with a different scene playing right after it. Any idea how I could pull this off? Any help will be appreciated :).

The key elements will be comparing the score to 50 and then loading a cutscene, perhaps one you make using Timeline and/or Cinemachine.

If you need to return to the game after the cutscene, you will need some form of inter-scene persistence.

Which specific part are you struggling with? This is all extremely well-covered in Unity tutorials on Youtube and on Unity’s site itself. If you are not able to sort it out from those, then this text box will be even less useful to you.

Two steps to tutorials and / or example code:

  1. do them perfectly, to the letter (zero typos, including punctuation and capitalization)
  2. stop and understand each step to understand what is going on.

If you go past anything that you don’t understand, then you’re just mimicking what you saw without actually learning, essentially wasting your own time. It’s only two steps. Don’t skip either step.

I’m trying to figure out things on my own most of the time, but I’ve read a few guides. Turns out I forgot to put the code for checking whether the player has the needed score in “Update”, so it only checked once, I presume.

1 Like

Yes, it’s definitely one thing to write some code and another thing entirely to hook that code up so it actually gets called when you want it to be.

The first thing you should ALWAYS suspect is “Hey, maybe my code isn’t being called.”

You’ll be amazed at how often that is the case. I’ve been at this for four decades and I still constantly encounter this in my own work, simply because the computer is pedantic and has explicit requirements for when stuff will be called. If you don’t meet those requirements, well, guess what? :slight_smile:

All of this is instantly solved by debugging.

By debugging you can find out exactly what your program is doing so you can fix it.

Use the above techniques to get the information you need in order to reason about what the problem is.

You can also use Debug.Log(...); statements to find out if any of your code is even running. Don’t assume it is.

Once you understand what the problem is, you may begin to reason about a solution to the problem.