Hello, I decided to learn how to create editor windows. Most things are going fine, but I am having a hard time getting an image to show up. For a simple test my .uss file just specifies a width and height for the image (100,100). When using the UI Element debugger i can see it is there, but I can never actually see the image I am trying to set.
The c# code I am using to set its image, and add it to my root visual element is
Image image = new Image();
image.image = Resources.Load("TestTexture.png") as Texture2D;
root.Add(image);
Can anyone tell me what I am doing wrong / the correct way to display an image. I looked at the UI Samples but didn’t see anything, and also checked out the UI Element examples github project but didn’t see anything about Images, unless I overlooked it.
What I want to achieve is a little tool that I can use to help me create scriptable objects for my game, where i specify text data with text fields, a sprite via an object field, I want to have a nice visual of the sprite when i set it and that is what I will eventually use the image for.