Do something different based on the scene the player is in

Let’s say I’m making a game where I want each scene to have a different effect on the player, but rather than make a different script for each scene, I just want to have one script that checks which scene the player is in then applies whatever effect to the player (e.g. one scene is an ice world that slows down the players movement, and another is an energy world that speeds them up).

I’ve seen the tutorial that shows how to switch scenes via scene ID, would the same thing work here? Something like if(scene id = iceWorld){slow down player} else if(scene id = energyWorld) {speed up player)(I know the scene id is a series of numbers, this is just for example).

I wouldn’t use the scene id as that can change if you fork the project.

You can have a script that has information about the level on the scene root object, use a tag on the player game object (assuming there’s one in every scene?) or a global object that exists throughout the whole game that manages the scene loads and therefore knows which scene is loaded.

So if I were to add an entity called level data, and tag it differently in every scene. Then just check the level data entity and apply changes based on the tag?

Yes. There’s a couple of caveats but you should be able to work through them.

You are basically doing this: