So i have made a nice editor for making tilemaps but today i noticed a bug in my editor. When i load a scene it keeps the references to the old scene which leads to alot of errors. This happens even when loading the same scene.
But when i just start unity up and that scene gets loaded it works fine. The serialization part also seems to work fine when i go into playmode and back.
What is the proper way to fix this?