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

<p>Basically, I wrote a native plugin, which loads image data using C++ &amp; 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 &amp; Android during the experiment. </p>

<p>Let me know if this is what you want to achieve &amp; I can pass on the code to you. </p>

<p>Best. </p>

CC BY-SA 4.0
2019-06-08T13:11:02.003Z
2019-06-08T13:11:02.003Z
TheOrestes
<p>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..</p>

<p>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?</p>

<opengl><texture><unity>
Unity: Pass texture pointer from OpenGL to Unity
Roman
# Unity: Pass texture pointer from OpenGL to Unity

(Asked by: username_0 on 2019-06-06)

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?

**Tags:** opengl, texture, unity


---

## 1 answers

### Answer by username_1 on 2019-06-08. Score: 0

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.


---

