Game freezes when changing scenes with global variable

im having trouble with my game changing scenes and freezing it will change scenes perfectly until the timer i have set up to drop the value of a global variable hits its set time and when the variable has dropped in value the game freezes when changing scenes any advice

Send a screenshot of your events please :slight_smile:

The first is for my first scene and the second is for my second scene. As I said the scene changes perfectly until the wulfengardtemp global variable decreases then it freezes when changing to the second scene

All of your events are running forever, most of them should have Trigger Once…however I’m also not seeing your event to change the scene so I can’t tell you what may be wrong with it.


2 things to check:

  1. You can’t change the scene in the event sheet and then also take an action on the object. So the “Change the position of wulfengard” action in that bottom event probably needs to be removed.
  2. As mentioned above, you’re trying to change the scene infinite times (each event occurs every frame). Try adding a “trigger once” to the condition on the left side of that event.

its still freezing even after removing the action on the object and adding a trigger once. maybe it will be simpler to explain what i want to do. i need a variable for my characters temperature like in a survival game. it is cold outside so his temp gradually decreases when outside but when near a fire or inside a building it gradually increases. how would i implement that

Are you storing the variables on the object?

As far as I know, object variables reset per scene, even if the object is global. That may also be tripping up your issues. It may not necessarily be related to changing the scene, but more so that your other scene is looking for object variables with no values.

no i made them all global variable which i was led to believe were used over all scenes

Yep, global variables should cross scenes.

What about timers? I’m seeing a few timers in your screenshots above on the object. Those timers may not exist when you cross scenes.

Can you try disabling any events that have a “The timer of wulfengard” as a condition?

i copied over my conditions and actions for decreasing the variable (even though they are unnecessary) to my second scene and now it is working.