Keep some UI alive between scenes

I was planning to keep one UI element alive between scenes using DontDestroyOnLoad but that is causing warnings and essentially not working. I wonder if I need to call DontDestroyOnLoad on the canvas as well, and if that can cause issues since each scene has a canvas with different elements but there is this one in particular that I want to always keep alive.

I thought of having a new one for each scene, but the component has some state, and keeping that state alive seems easier than passing it around. How to deal with this?

You have to call DontDestroyOnLoad on the canvas as well if you want to preserve the UI element. As long as you set the Sort Order on the Canvas component correctly, it shouldn’t pose an issue to have multiple UI canvas on the scene. If you have any additional questions as to how to implement it, let me know.