Closed podborski closed 4 years ago
I'm not affiliated with Unity.
Unity calls UnityPluginLoad
in the plugin dll when the plugin is first accessed. This calls OnGraphicsDeviceEvent
directly (at the end of the function), and also registers that function with Unity here: https://github.com/Unity-Technologies/NativeRenderingPlugin/blob/2b8ca29bb59cdf981b8a9b669cb334bd09f6b44f/PluginSource/source/RenderingPlugin.cpp#L98 so that it will be called when a graphics device event occurs (e.g. shutdown).
@samjacobson Thank you :) This explains it. I just tested it and indeed, UnityPluginLoad
gets called automatically.
Is there any documentation on it that I have missed?
https://docs.unity3d.com/Manual/NativePluginInterface.html mentions the UnityPluginLoad.
Wow, how could I miss that? Thank you again!
Sorry for bothering you guys, but I really would like to understand one thing.
Can somebody explain to me why
RegisterPlugin()
is called only forWEBGL
? https://github.com/Unity-Technologies/NativeRenderingPlugin/blob/2b8ca29bb59cdf981b8a9b669cb334bd09f6b44f/UnityProject/Assets/UseRenderingPlugin.cs#L56-L57I don't quite understand from the code how
OnGraphicsDeviceEvent
(which creates an instance of the RenderAPI) gets called.In other words, when not using
UNITY_WEBGL
how doesCreateRenderAPI
gets called? https://github.com/Unity-Technologies/NativeRenderingPlugin/blob/2b8ca29bb59cdf981b8a9b669cb334bd09f6b44f/PluginSource/source/RenderingPlugin.cpp#L144I know that I am missing something, since the code seems to work just fine.
Thank you very much.