ReactUnity / core

React and HTML framework for Unity UI & UIToolkit
https://reactunity.github.io/
MIT License
733 stars 42 forks source link

Image Quality/Resolution #81

Closed Carln02 closed 1 year ago

Carln02 commented 1 year ago

Hello! I started checking out your library recently and I encountered a small issue with images. Both non-rectangular PNGs and SVGs appear pixelated and low resolution, no matter how high the original resolution of the image is. Below you can find a screenshot of what I'm talking about. The star's image file is a 1028 by 1028px PNG.

Screenshot 2023-01-21 143724

Thank you!!

KurtGokhan commented 1 year ago

Can you provide the following information?

Carln02 commented 1 year ago
  1. The code is quite long, but if I run the following in the index file:
import picture from "src/assets/icons/--primary-main/star-filled.png";
export function App() {
   return (<image source={picture} style={{width: '100px', height: '100px'}}/>);
}
Renderer.render(<App />);

I get the same pixelated output:

Screenshot 2023-01-21 173225
  1. Can I access images from the "Assets" folder? Whenever I try to input a path that goes outside the "src" folder in the react project I get an error. The image is placed inside this src folder and it doesn't have a .meta file.

Here is the asset: star-filled

  1. If I place the same image as a 2D sprite in Unity it looks perfectly fine.

And thank you so much for the help!

KurtGokhan commented 1 year ago

I see. Image imports from file are imported with some default settings. I changed those settings to maximize quality now.

Fixed on main branch. I won't release a new version urgently as the problem only exists in development. In build, you have to go to the build folder and modify image import settings manually anyway.

Carln02 commented 1 year ago

Oh okay great!! Thank you for your help :)

KurtGokhan commented 1 year ago

Forgot to update, this is already fixed in 0.14.2