Jbonavita
Give the following code, the child node, spinBtn is displaying behind bottomSpriteNode. Any idea why?
Node bottomSpriteNode = scene.CreateChild("StaticSprite2D");
float halfWidth = Graphics.Width * 0.5f * PixelSize;
float halfHeight = Graphics.Height * 0.5f * PixelSize;
// Get sprite
Sprite2D sprite = ResourceCache.GetSprite2D("Urho2D/BottomLine.png");
if (sprite == null)
return;
StaticSprite2D staticSprite = bottomSpriteNode.CreateComponent<StaticSprite2D>();
staticSprite.Sprite = sprite;
var size = (sprite.Rectangle.Bottom - sprite.Rectangle.Top) * PixelSize;
bottomSpriteNode.Position = (new Vector3(0, -(camera.OrthoSize / 2) + (size / 2), 0));
Node spinNode = scene.CreateChild("StaticSprite2D");
Sprite2D spinSprite = ResourceCache.GetSprite2D("Urho2D/SpinBtn.png");
if (spinSprite == null)
return;
staticSprite = spinNode.CreateComponent<StaticSprite2D>();
staticSprite.Sprite = spinSprite;
bottomSpriteNode.AddChild(spinNode);
size = (spinSprite.Rectangle.Right - spinSprite.Rectangle.Left) * PixelSize;