What you can do is using Sprite.Create to generate a sprite from a given Texture2D. TextureImporter belongs to the UnityEditor namespace which doesn't exist in a built app but only within the Unity Editor itself. What I want is all procedure worked by Script It is not working When running project on Android or IOSĭuring running on Android or IOS Platformġ) Receive some Images from server (Url or file)ģ) Change type Images to Texture or Sprite ect. Public void OnPostprocessSprites(Texture2D texture, Sprite sprites) TextureImporter.spritesheet = metas.ToArray() Meta.rect = new Rect(c * spriteSize, r * spriteSize, spriteSize, spriteSize) SpriteMetaData meta = new SpriteMetaData() Int rowCount = texture.height / spriteSize Int colCount = texture.width / spriteSize Public void OnPostprocessTexture(Texture2D texture)ĭebug.Log("Texture2D: (" + texture.width + "x" + texture.height + ")") TextureImporter.filterMode = FilterMode.Point TextureImporter.spriteImportMode = SpriteImportMode.Multiple TextureImporter.textureType = TextureImporterType.Sprite TextureImporter textureImporter = (TextureImporter)assetImporter I trying to use UnityEditor Class and it is work on Computerīut When I trying to Build Android or IOS It is failed. When project is running on Android or IOS Platform I trying to slice Sprite(type casted to Texture2D) by script,
0 Comments
Leave a Reply. |