05-01-2019, 05:23 PM
I was able to get some coding in over the weekend. And I've got a new tutorial posted!
Embedding Tilengine in Unity: Memory Management
This tutorial takes it back to the basics, and rolls a minimalist DLLImport wrapper for the Tilengine functions. It also bundles up the references and primary functions of Tilengine up into an IDisposable class to make it more palatable to C#'s garbage collector. It seems to be working fairly well in Unity, with the Tilengine contexts getting created and destroyed properly, and at the appropriate times. This approach is much more friendly and stable when it comes to Unity's editor environment. With this approach, I was also able to test multiple Tilengine contexts running concurrently, without any issues.
Now obviously, this is just an early prototype, as most of the functionality is missing with this approach. But the rest is just a matter of structure, and deciding how best to integrate the various Tilengine structures into Unity's interface.
Also, as a bit of a personal challenge, I took the basics that I had developed here and tried integrating them into the Monogame framework. I had to make some adjustments for the framework-specific structures. But the underlying code for the memory management and Tilengine mapping required no changes at all. I was able to get a very similar project embedded and running in Monogame as well with little difficulty. I'll be posting another Monogame-specific tutorial soon as well.
Embedding Tilengine in Unity: Memory Management
This tutorial takes it back to the basics, and rolls a minimalist DLLImport wrapper for the Tilengine functions. It also bundles up the references and primary functions of Tilengine up into an IDisposable class to make it more palatable to C#'s garbage collector. It seems to be working fairly well in Unity, with the Tilengine contexts getting created and destroyed properly, and at the appropriate times. This approach is much more friendly and stable when it comes to Unity's editor environment. With this approach, I was also able to test multiple Tilengine contexts running concurrently, without any issues.
Now obviously, this is just an early prototype, as most of the functionality is missing with this approach. But the rest is just a matter of structure, and deciding how best to integrate the various Tilengine structures into Unity's interface.
Also, as a bit of a personal challenge, I took the basics that I had developed here and tried integrating them into the Monogame framework. I had to make some adjustments for the framework-specific structures. But the underlying code for the memory management and Tilengine mapping required no changes at all. I was able to get a very similar project embedded and running in Monogame as well with little difficulty. I'll be posting another Monogame-specific tutorial soon as well.