How to create a "level completed" message between levels

Just can you please tell me what can I do to make a win screen popup after each level complete (any you tube tutorials or something similar).

Hi Vivek,

There are a couple of directions you could go in for this.

You could consider creating a new scene with perhaps a simple text object on it, “Level Complete” for example. You could perhaps put this as the last scene in the build settings so that the existing code will not just “step” on to it. You could store the lastCompletedLevel as a static variable so as to persist the value, setting it to the last completed level before loading the LevelCompleted scene.

The LevelCompleted scene would then wait for a configured amount of time before automatically loading the next scene, which would be the lastCompletedLevel variable +1.

That would be one approach, it would be reasonably easy to put together but the downside is that you would be traversing scenes a lot more, back and forth etc.

An alternative approach may be to use another canvas in each of your levels and use it as an overlay for the main game scene. You would need to position it between the existing playspace and the camera. You could then use code to change the opacity of canvas, so, at the beginning of a level it appears completely transparent, then changes to a solid colour when the wave it complete. Add a text object to this with whatever text you want.

You would again need to add a little code for a delay, before then going on to loading the next scene as you already are.

An advantage of this would be that you could easily adapt the text based on the current scene, you would be able to access properties from the current scene without having to store any additional information, so for example, you could grab the build index of the current scene and use that within the text you display, e.g. “Level 1 Complete!”, that kind of thing.

It would also mean less traversing of scenes which would be beneficial to the player. You would of course need to add that as part of each scene’s setup, but that isn’t really any different from the existing playspace, and if you have prefab’d that then you could just up the prefab to include this new functionality also.

When you get to Glitch Garden, a similar approach is used at the beginning of the game to provide a fade effect, it works well.

Hope this helps. :slight_smile:

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms