- Home /
Draw only a part of a GUI Image
I want to draw a GUI Image inside of another GUI Image.
I want to draw a square in a circle, like the red square and not like the blue square.
The square also needs to be moved, so I don't want to make tons of images for every possible position in the circle.
Is there a simple way to do this(I don't think DrawTexturewithTexCords would be fitting) or do I just have to build around it?
Thanks in advance
Answer by robertbu · Jul 26, 2014 at 06:34 PM
There's no direct way to do this in the GUI class. You can hide it by using transparency in the middle and opaque around the outside and having the circle drawn last. I've made the outside green to demonstrate:
If the movement is not dynamic, it is possibly to modify the texture to clip the appropriate area, but that is not something you want to do every frame. And it is somewhat complicated to implement.
It can be done with a shader for world objects.
Your answer
![](https://koobas.hobune.stream/wayback/20220613155036im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Changing universal range for space games??? 1 Answer
Projection Covers everything 0 Answers
Dynamic Texture Tiling 1 Answer
Fixed distance between objects? 2 Answers
How to shorten/extend an object? 2 Answers