Quantcast
Channel: Questions in topic: "dll"
Viewing all articles
Browse latest Browse all 706

Get a font from an assetbundle that is mebedded in dll?

$
0
0
Hi I am trying to read a font from a dll file and put it under resources folder in "editor". some one long ago suggested that We should use asset bundles for this. so, in unity 2017, i created an asset bundle from the font itself. the font was sitting in the root of Assets folder. when I look into the manifest I see that it says Assets/FontAwesome now, I embedded that asset bundle as binary in a dll project, this is the code I tried to use and get the font out of the bundle to write it in the folder : byte[] bytes = typeof(FolderConstruction).Assembly.GetFromManifest("Buzz.Utils.Unity.Editor.Resources.fontawesome.bin"); var fontBundle = AssetBundle.LoadFromMemoryAsync(bytes); var font = fontBundle.assetBundle.LoadAsset("FontAwesome.ttf"); var resource = AssetDatabase.LoadAssetAtPath(Resource.GLOBAL_RESOURCES_FOLDER + "/" + Resource.FONT_FOLDER_NAME + "/FontAwesome.ttf"); if (resource == null) AssetDatabase.CreateAsset(font, Resource.GLOBAL_RESOURCES_FOLDER + "/" + Resource.FONT_FOLDER_NAME + "/FontAwesome.ttf"); AssetDatabase.Refresh(); When I run this code, I get these two errors : Failed to decompress data for the AssetBundle 'Memory'. System.NullReferenceException: Object reference not set to an instance of an object at Buzz.Utils.Unity.Editor.FolderConstruction..cctor () [0x00000] in :0 UnityEditor.EditorAssemblies:ProcessInitializeOnLoadAttributes() the first byte[] returns correctly so I am sure I am reading the asset from the dll resources correctly, the problem sits after that, but i am not familiar enough with assetbundles to see what is wrong here. please help

Viewing all articles
Browse latest Browse all 706

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>