Hello,
I have a bunch of Sprites in an Asset Bundle. I can get the sprite by the LoadAsset command
Sprite sprite = backgroundCanvasAssetBundle.LoadAsset(fullpathIncludingFileName, typeof(Sprite)) as Sprite;
However, if I use the LoadAssetAsync command, which give me an AssetBundleRequest I can only get a Texture2D from the AssetBundleRequest.asset. Meaning I have to use Sprite.Create (which is slow)
Texture2D texture = requestedAssets[i].asset as Texture2D;
Sprite sprite = Sprite.Create(texture,newRect(0, 0, spriteSize, spriteSize),newVector2(-1f,-1f),spritePixelsPerUnit);
This doesn’t work:
Sprite sprite = requestedAssets[i].asset as Sprite;
Am I missing something ? Or can you not cast as a type with AssetBundleRequest.asset?