04-19-2019, 05:39 PM
Hi Richard, thanks for your detailed overview about Unity's editor workflow. I can think about two solutions:
If Unity runs standard C# with garbagge collector, yoo can create a class that implements de Disposable interface. If the Unity environment destroys all objects when the preview is closed, the GC should call the Dispose() method that you defined in your class, and this method should call the TLN_Deinit() or TLN_DeleteContext(). This should be the way in regular desktop applications.
If that solution is not possible (I don't know how Unity handles C#), I could do a small modification to Tilengine to work with just one instance: calling multiple times TLN_Init() will keep returning the same context. That would allow the context to persist across multiple launches. That's how Tilengine worked before I implemented multiple contexts.
Do you think any of these solutions should work?
If Unity runs standard C# with garbagge collector, yoo can create a class that implements de Disposable interface. If the Unity environment destroys all objects when the preview is closed, the GC should call the Dispose() method that you defined in your class, and this method should call the TLN_Deinit() or TLN_DeleteContext(). This should be the way in regular desktop applications.
If that solution is not possible (I don't know how Unity handles C#), I could do a small modification to Tilengine to work with just one instance: calling multiple times TLN_Init() will keep returning the same context. That would allow the context to persist across multiple launches. That's how Tilengine worked before I implemented multiple contexts.
Do you think any of these solutions should work?