0
$\begingroup$

I'm working on a scene in Unity where I have textures loaded at runtime. As a result of that, the scene is being slowed down (even with co-routines), so I thought maybe I could move the texture loading task to a plugin and have it run as a parallel thread..

Is there a way to load a texture with OpenGL in a Unity native plugin, and return a pointer back to the scene for further use?

$\endgroup$
0
$\begingroup$

I am not sure if doing this is right or wrong or actually needed in practice. However, I was curious once & wanted to learn about Unity Native plugins, so i decided to do exactly what you need.

Basically, I wrote a native plugin, which loads image data using C++ & stb_image library, it then passes byte[] to Unity C# side where it gets applied on a quad. There are many things you need to consider if it's a cross platform app, I was able to run it on both PC & Android during the experiment.

Let me know if this is what you want to achieve & I can pass on the code to you.

Best.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.