Is there a contained memory enviornment for a Native DLL's memory allocation between Editor and Game modes?
Currently, I am in the process of making a plugin for Unity that relies heavily on a runtime that exist in a native DLL that will handle most of the processing. The Native DLL will make and manage it's own allocations using a specialized memory allocator. The Native DLL however, does not handle any rendering, so that must go to the Unity's side.
Going to the Unity side, I would like for this data to then be rendered in a preview port of a custom renderer. As well as allow the Main editor to preview the result after it's attached to an object. The problem the comes to whether or not Unity is able to make a difference between the Game's Memory space, and the Editor's Memory space.
Is the memory allocated by the DLL shared between Unity's Editor and the Game? Or are the game mode, and the Editor treated as separate pocesses? Thus have their own memory spaces?
Answer by Baroque · May 19, 2017 at 09:44 PM
No, native plugins are initialized once then remain in the same process space as the Unity editor executable. Any allocations persist between play mode and edit mode.
It wouldn't be especially difficult to have a stub DLL that stays persistent and loads/unloads the actual DLL as play begins and ends but this isn't how Unity works out of the box.
Your answer
Follow this Question
Related Questions
How much memory does each PlayerPrefs take? And what About XPlayerPrefs? 0 Answers
plugin inspector not working for OSX bundle 1 Answer
Unity Total System Memory Usage GO CRAZY?! memory leak 0 Answers
Using .framework for iOS as Plugin. 0 Answers
Audio Spatializer Plugin SDK: how can plugin get channel count of input audio source? 0 Answers