![]() ![]() You can use it to (for example) download jpeg files from a server and convert them to a useable texture, to avoid shipping large textures with the game. It accepts both png and jpeg files and converts them to textures at runtime. Just spit-balling, there could be designated "UI" folder under Resources that always imports graphics with original aspect.Click to expand.This is quite easy to do, use ImageConversion.LoadImage. Yet, you have to go back and forth every few minutes and never make a mistake.ġ.) That the documentation is much clearer on the consequence that all UI images will have their aspect modified unless manual steps are taken on every single image.Ģ.) That a way to partition these two workflows is invented. ![]() Power is two is practically always good for 3D, and practically always bad for UI elements. The problem is that you can't simply set a default setting. Mistakes won't be discovered a percentage of the time, and will make it to release. A human must continue to take special steps after each import, or graphics become warped. This prevents artists from simply dropping graphics into a directory, because they'll actually be changed by Unity. But since it's by default destroyed by the power of two process, you have to go to every single texture, switch it to None and Apply that. When power of two is bad: For UI images, the aspect matters a lot. You can and should use power-of-two sizes, for GPU performance. No matter how you scale a texture, you'll get the same aspect in the render. The aspect comes from the UV coordinates on the geometry. When power of two is good: For textures, the aspect doesn't matter. I'm a bit trying to convince you that UI Elements is casually mixing two hostile concepts, that are a workflow impediment and will result in significant human error. Is there a way to use an image in VisualElements where it retains the aspect of the original image? Or is background-image + manual aspect the only game in town? Or, is the only way to use images to make them a background to a VisualElement anyway, meaning that you always have to know the image aspect? Because in that case, it's less important if Unity has conformed the image to power-of-twos, since it'll be scaled right back, just losing some pixel resolution possibly. ![]() So the question is whether it's dangerous to use resources for non-power-of-two graphics, or whether UI Elements has special knowledge and resolves the texture in its original size. So the pixels are being tweaked, which I don't love. But when I inspect the texture settings for the image, it has clearly been conformed to 32x32. Right now, I'm loading a 40x30 graphic as a resource, and the image looks OK in the UI only because I'm setting it as a background on a VisualElement that has the same aspect. I had to load them as a bytearray and then make a texture based on a bytearray to get a runtime size like the original. Click to expand.If you load images as resources, don't you become subject to texture rules, including power-of-two rules? I've had some problems with other resources (non UI Elements context), where adding them as a resource changed their dimensions when I loaded them. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |