Catch unity generated exceptions(Texture rectangle out of bounds)
Hello everyone. I tried sometimes to catch unity generated exceptions, but standard try-catch blocks do not work with unity exceptions. In my current case I need to catch Texture rectangle is out of bounds UnityEngine.Texture2D:SetPixels(Int32, Int32, Int32, Int32, Color[])
exception. How do I do it?
UPD: The reason I need to catch the error is that I cannot simplty check with if(texture.GetPixel(x,y) !=null)
or someway else because I use SetPixels and I apply about 200 pixels per frame, so can't check each of these pixels if it is not out of bounds, it will hit performance. I need to catch the error.
Your answer
![](https://koobas.hobune.stream/wayback/20220612051649im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Crunch Texture compression throws exceptions 0 Answers
Clear intersection Texture 0 Answers
Streaming Assets load Texture File and Set texture 0 Answers
Circular Whipe Effect 0 Answers