Is shame unwanted but needed or indulgent?


If the purpose of shame is to let us know when our actions are misaligned with our values, then is shame unwanted but needed? Is it only when shame keeps us in a place of beating ourselves up and not taking action that it is indulgent? Can shame ever be a motivator? Or is it always some other feeling that is the motivator to change action?