Xamarin: loading resources via GetManifestResourceStream

I am working on a Xamarin forms project to use OpenGL / OpenTK. I am trying to load a shader using GetManifestResourceStream. Whatever I do, I get null

the code is run from the .Shared project, the shaders are located in the .ios / .Android resources directory

string prefix;

#if __IOS__ 
prefix = "OpenGLTesting.iOS.";
#endif
#if __ANDROID__
prefix = "OpenGLTesting.Droid.";
#endif

var assembly = typeof(App).GetTypeInfo ().Assembly;
Stream stream = assembly.GetManifestResourceStream (prefix + shaderName + ".glsl");

      

+3


source to share


1 answer


Add debug code like call assembly.GetManifestResourceNames ();

, so make sure you have both the correct name and that it was built into your assembly.



+3


source







All Articles