- Home /
How do I ; from inside another script, read an image resource inside a DLL
Hi , I have a DLL with an image resource in it . I also have classes in the Dll which inherit from UnityEngine and other libraries .
The issue is that I'm trying to access a .png image resource which I placed inside my dll file . I have an editor scripr from which i will access the dll and image resource that i placed in the dll .
after accessing the image i want to assign it to the Texture to be used in a GUI .
Similarly to how we handle Resource.Load.... except i'm loading the texture from my dll , not from inside a Resorces folder.
How can I get this done ?
I am looking at ResourceManager , trying to figure it out
is your dll actualy working in Unity ? can you call some methods ?
oh, yeah everything works fine. I just need to be able to access the image resource in the dll
I dont know if that may help but here is an extractor maybe running another process using Unity can make it , not sure
oh, no no I am not trying to extract the image resource from the DLL . I just need to read the dll and assign the image in the dll to a Texture2D .
well first allocate the texture not in the dll , then try to pass all data to the texture , by that I mean the dimension , n bits , etc. But it mights have diff. because of the encapsulation of the classes.
Answer by DaiMangouDev · Apr 02, 2015 at 08:40 PM
Hi DMDev . this is how you read an image resource from a dll
//DaiM.Reality is the namespace
//flg would be any class in your dll using the namespace
Assembly asm = typeof(DaiM.Reality.fgl).Assembly;
string resourcename = asm.GetName().Name + ".Properties.Resources";
ResourceManager rm = new ResourceManager(resourcename, asm);
Just one problem . Unity does not support System.Drawing so anything related to System.Drawing seems to not work . so good luck converting the bitmap resource to Texture 2D..... and the story continues another method of importing resources
seems like we just need to drag a compatable version of the System.Drawing library into our project folder for it to work