Search Issue Tracker
By Design
Votes
4
Found in
2018.4
2019.4
2020.3
2021.1
2021.1.0b8
2021.2
Issue ID
1319547
Regression
No
SpriteMask data is ignored in Sprite when drawing with CommandBuffer.DrawMesh to a RenderTexture
How to reproduce:
1. Open the user's attached "DrawMask.zip" project
2. Open the "SampleScene" Scene
3. Enter Play Mode
4. Observe the Sprite on the right in the Game view
Expected result: Both left and right Sprites have a cutout area in the center
Actual result: Only the left Sprite has the cutout area
Reproducible with: 2018.4.32f1, 2019.4.22f1, 2020.3.1f1, 2021.1.0f1, 2021.2.0a9
-
Shapely
Mar 08, 2023 22:47
This is an issue I have come across. I am trying to use a render texture to capture a section of a sprite using a sprite mask to set the size and shape of the render texture output. As the render texture output has no sprite mask info the output is nothing. The render texture works fine with sprites not interacting with sprite masks. As stated above this is not a bug but an unsupported feature. I would really like to see this feature supported as it would allow for the use of sprite masks to select from large sprites out of the way of the main camera in the scene, without having overlapping sprite masks messing each other up.
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Standalone Player crashes with "TDerived GetOrLoad<TDerived>() where TDerived : T" when IL2CPP Code generation is set to "Faster (smaller) Builds"
- IndexOutOfRangeException and InvalidOperationException when logging XML string
- Script missing in "Assets/Settings/Mobile_Renderer/GlobalVolumeFeature" of "com.unity.template.urp-blank" template
- “Font Asset Creator - Error Code [Invalid_File_Structure]…“ error is logged when generating Font Assets from fonts with meta files from previous Editor versions
- Input.mousePosition returns (NaN, NaN, 0.00) when Scene view is opened
Resolution Note:
This isn't a bug and is feature that isn't supported at the moment. The function CommandBuffer.DrawMesh is working as intended as it adds the specified mesh with the material to be drawn. The stencil setup required for sprite mask is handled internally and is not exposed in the scripting api. I've added it to our backlogs as a new feature request.