I have done quite a bit of searching, however, I was wondering if someone could give me a direct explanation.
I am creating a C# script for an RTS game that draws a rectangle using screen coordinates from two stored Vectors (acquired from the expression Input.mousePosition). I want to create a selector script. Can anybody help?
Thanks heaps in advance,
Create a new folder in your Assets and name it “Resources”,
put a white texture of any size (32x32 for example) inside and name it WhiteTexture (It can be BMP, TGA, PNG, JPEG…) and do something like this in OnGUI function:
Texture2D MyTexture = Resources.Load("WhiteTexture") as Texture2D;
GUI.color = new Color(1.0f , 0, 0);//Set color to red
GUI.DrawTexture(new Rect(positionX, positionY, sizeX, sizeY), MyTexture); //positionX, positionY, sizeX, sizeY shuld be your stored vectors
GUI.color = Color.white;//Reset color to white
This will draw Red Rectangle.
Its just a pseudo code…
@TheDeveloper Do accept the Answer if its Helpful =)