Core Goal
Reveal a hidden image through player input while keeping the effect responsive and performant.
Initial Approach
Mask prefabs were instantiated at the cursor while scratching, visually erasing the surface through overlapping objects.
Instantiate(maskPrefab, clickPosition, Quaternion.identity);
Why It Didn’t Scale
Per-frame instantiation introduced unnecessary overhead and scene clutter, and made tuning scratch behavior harder than it needed to be.
Final Approach
A custom shader samples a scratch mask texture and drives transparency directly in the material, revealing the image without spawning objects.
col.a *= (1 - mask);
Result
Cleaner logic, predictable performance, and faster iteration by turning the scratch effect into a data-driven visual system.