Hi,
I recently started to migrate some previous sourcecode from Unity to Stride. It´s a basic user interface for a realtime strategy game and meanwhile I´m facing some problems during the migration. Maybe someone of you people here could help me with it.
The problem:
I used some basic drawing operations in Unity to show the mouse selection area to the player. I also put some rectangles around the selected buildings and units. But somehow I was not able to migrate this simple task to Stride/Xenko.
Here are some code snippets from Unity (I´ve found them originally in some YouTube tutorials):
m_SelectionTexture = new Texture2D(1, 1);
m_SelectionTexture.SetPixel(0, 0, Color.white);
m_SelectionTexture.Apply();
…
protected void DrawScreenRect(Rect rect, Color color)
{
GUI.color = color;
GUI.DrawTexture(rect, m_SelectionTexture);
GUI.color = Color.white;
}
…
protected void DrawScreenRectBorder(Rect rect, float thickness, Color color)
{
this.DrawScreenRect(new Rect(rect.xMin, rect.yMin, rect.width, thickness), color);
this.DrawScreenRect(new Rect(rect.xMin, rect.yMin, thickness, rect.height), color);
this.DrawScreenRect(new Rect(rect.xMax - thickness, rect.yMin, thickness, rect.height), color);
this.DrawScreenRect(new Rect(rect.xMin, rect.yMax - thickness, rect.width, thickness), color);
}
So maybe Stride/Xenko is not working that way. But is there an alternative way to get similar results?
I would be grateful for suggestions and advice.
Best regards,
Michael