 
                 // Looking for a transparent pixel (sprite border from inside) around computed fragment with given depth (_OutlineSize).
                 // Also checking if sampled fragment is out of the texture space (UV is out of 0-1 range); considering such fragment as sprite border.
-                [unroll(10)]
-                for (int i = 1; i < outlineSize + 1; i++)
+                for (int i = 1; i <= SAMPLE_DEPTH_LIMIT; i++)
                 {
                     float2 pixelUpTexCoord = texCoord + float2(0, i * _MainTex_TexelSize.y);
                     fixed pixelUpAlpha = pixelUpTexCoord.y > 1.0 ? 0.0 : tex2D(_MainTex, pixelUpTexCoord).a;

                    float2 pixelLeftTexCoord = texCoord - float2(i * _MainTex_TexelSize.x, 0);
                    fixed pixelLeftAlpha = tex2D(_MainTex, pixelLeftTexCoord).a;
                    if (pixelLeftAlpha > alphaThreshold) return 1;
                }

                return 0;

            fixed4 ComputeFragment(VertexOutput vertexOutput) : SV_Target
            {
                UNITY_SETUP_INSTANCE_ID(vertexOutput);

                fixed4 color = SampleSpriteTexture(vertexOutput.TexCoord) * vertexOutput.Color;
                color.rgb *= color.a;

                int isOutlineEnabled = UNITY_ACCESS_INSTANCED_PROP(_IsOutlineEnabled);
                fixed4 outlineColor = UNITY_ACCESS_INSTANCED_PROP(_OutlineColor);
                int outlineSize = UNITY_ACCESS_INSTANCED_PROP(_OutlineSize);
                float alphaThreshold = UNITY_ACCESS_INSTANCED_PROP(_AlphaThreshold);

                #ifdef SPRITE_OUTLINE_OUTSIDE
                int shouldDrawOutline = ShouldDrawOutlineOutside(color, vertexOutput.TexCoord, isOutlineEnabled, outlineSize, alphaThreshold);
                #else
