how to make your game in unity change levels after collecting a certain amount of pick ups,

i am making a game where the player is a ball and it is collecting pick ups that look like targets. i followed the roll a ball tutorial and now i am having trouble. i know to switch scenes i have to use scenemanager.loadscene and all that junk but it won’t work for me. I don’t know if i am supposed to make a new script or to attach it to the player controller script. please help and thank you. here is a copy of my player controller script
[110016-player-controller-script-2.pdf|110016]

,

Try looking at this, it is used to load different scenes. You could have an if statement check if you have enough pick-ups and call that method if it passes the check.

Your existing script is fine so far. In your function SetCountText you’re checking whether the # of items collected has reached a certain number, and displaying a message when that happens. Instead of showing the message, you can put a call to LoadScene right there. Put the line “using UnityEngine.SceneManagement;” at the top of your file, and in that SetCountText function, say “SceneManager.LoadScene(“new_scene”);”. The scene name should be another scene file that you’ve saved.

Note that you will also need to include that scene in your list of existing scenes in the build. To do that, go to the File menu, Build Settings. Drag and drop the scenes you’ll be using into the list there. You can then reference them in your code either by name or index number.