@Barefists I dont have access to the Graphics.UI on my platform (WMxR), but even so would like to see your solution since you opened this thread and only really add you found another way to do it, without showing that way.
This code is used with all the following:
var spriteContainer = Scene.CreateChild("StaticSprite2D");
var staticSprite = spriteContainer.CreateComponent\<StaticSprite2D\>();
staticSprite.Sprite = sprite;
When I use:
Sprite2D sprite = ResourceCache.GetSprite2D("Textures/UrhoDecal.dds");
sprite.Texture = ResourceCache.GetTexture2D("Textures/UrhoDecal.dds");
Or just
Sprite2D sprite = ResourceCache.GetSprite2D("Textures/UrhoDecal.dds");
It works for me.
If I use:
Sprite2D sprite = new Sprite2D();
sprite.Texture = ResourceCache.GetTexture2D("Textures/UrhoDecal.dds");
sprite.Rectangle = new IntRect(0,0, sprite.Texture.Height, sprite.Texture.Width);
This also works, but paints a rectangular shape with only a partial texture and black filling as my texture is not rectangular.
If I use just:
Sprite2D sprite = new Sprite2D();
sprite.Texture = ResourceCache.GetTexture2D("Textures/UrhoDecal.dds");
Then nothing paints but everything else works as intended.
@Modanung Why redirect to go look at a completely different engine, just because it’s not well known how to add a texture to a 2D sprite with C# bindings for Urho3D? I’m writing in C# and find Urho3D does most everything needed, but with C# bindings there is practically no documentation so it’s necessary to root through the C# feature samples and figure out with experimentation. That said I’ve been unable to get shadows working yet.
Edit: The black rectangle fill being visible depends upon the BlendMode chosen for the Static sprite. BlendMode.Add doesn’t show it, but BlendMode.Alpha does.