Hi, I am working on a game that takes place in space and I have a circular radar image that I am using and I want to be able to draw a red line for the boundary of space. I found that there are 2 ways to do this, but neither of them really work:
- Use the SetPixel command - This overwrites the texture within unity and I don’t know how to “refresh” the texture.
- Use something like Gui.DrawTexture(new Circle… - This does not exist, but something like it sure would be convenient. Even if I could do this with an image that is just a circle that I draw myself in Paint.Net or whatever that would be fine except the boundary size will be different with different kinds of maps that we use. So, I theoretically could just have a number of pre-drawn textures for the boundaries, but I would rather do it automatically.
If anyone knows how to do this, I would really appreciate the help / advice.
Let me explain how I am trying to do the 1st method.
I set a number of settings within Unity to be able to edit the image:
- Select the Texture itself in Unity.
- Set the Texture Type to “Advanced”
- Check the “Read/Write Enabled” checkbox
- Set the “Texture Format” to “ARGB 32 bit”
Then, I use the SetPixel(s) command(s) in a script that draws a circle for you wherever you like onto a Texture2D image. So far, so good.
!(http://www.morningstarproductions.org/Unity/with boundary.png)
However, when I start moving the ship, I obviously want the boundary on the radar to move also since the boundary is either closer to me or farther away. The player’s location should represent the center of the screen. But, as you can see, it gives me problems:
!(http://www.morningstarproductions.org/Unity/messed up.png)
I have looked into doing using the TextAsset type to use “LoadImage”, but I am unsure how that works or if that is even the right approach at this point since I know being able to do a command similar to DrawTexture
Thanks,
OldMonk