If you've had some bad run ins with stink bugs, you've were probably dealing with brown marmorated stink bugs that are native to Asia. They were accidentally introduced into the United States in the 1990s and are an orchard pest.
Many other species of stink bugs are also pests, but some are beneficial, like spined soldier bugs. Unlike the introduced Asian stink bugs, they are predators that feed on over 90 agricultural pests, including Mexican bean beetles and cabbage loopers. They're such good predators, their eggs are sold commercially for insect control programs in greenhouses. Unfortunately, naturally occurring populations aren't large enough to overpower large populations of pests in the spring.
Too bad they don't reproduce like the Asian bugs.
They may not be as numerous, but scientists have discovered that spined soldier bug mothers have one trick to help their offspring survive. They can lay darker or lighter eggs depending on how much light is reflecting off the surface of leaves. Darker colored eggs are found on the tops of leaves, while lighter eggs are found underneath. Scientists believe the dark pigment protects the eggs from damaging ultra violet radiation.
The eggs don't react to the sun exposure like human skin. Instead, the mother somehow senses the light and deposits pigment into the eggs before they are laid.
They also found that the eggs are not darkened by melanin pigment, which is found in many animals, but a new pigment that has never been seen before.
"An Insect With Selective Control of Egg Coloration" (Current Biology)
"USDA Researchers Find New Hope in the Fight Against Stinkbugs!" (WHYY)