Why is a person unhappy?

A reasonable question.

Situations present themselves.
We ask: What is going on?
The question can be answered only by a guide.
The two guides are: the ego; God.
The ego answers first.
This means the ego's answer is received, and is the only answer received, unless the system is manually overridden by deliberating placing oneself in God's hands before the situation arises or deliberately seeking a second opinion from God after the ego has answered.
The former works.
The latter requires the ego's answer first to be neutralised. Say to it: 'I am returning the answer you gave: I have no question for you.' This cleans the slate and allows God's answer to be given, and received without conflict arising.
If the ego's answer stands, a perception (= an interpretation) of the situation arises.
We think we have seen. We have not. We have perceived (= interpreted), in accordance with the ego's belief system. What we perceive is not objective reality but an interpretation. The perception will be flavoured with shame, guilt, and fear, because the ego's belief system is based on shame, guilt, and fear.

What is the result?
I believe I am unhappy, because of the world I see (internally and externally). But I have seen nothing. I have been presented with a picture generated based on incoming sense data, channeled through the ego's fear-powered processor, and projected onto the 'world' around me. I think the world has happened to me. In fact, I have happened to the world. (This antimetabole is typical of the ego's upside-down thinking).

What is the ego's belief system?
I am separate. There is no God, but God is simultaneously out to get me. I am trapped in a human body. I am going to die. Until then, I can secure position, reputation, and accomplishments that constitute my purpose, but these are impossible to reliably and consistently secure and retain because of other people's competition with me for those limited resources plus their obviously murderous intent. Nothing is ever enough. When the negative emotion becomes too much, there are a thousand ways to daze myself. This is life, short, blunt, rancid, and rounded not by sleep but by death. But at least I exist. At least I have an identity. At least I am real. At least I feel. At least I have myself.

What is God's belief system?
There is One Life and One God. God is Light and Love, and we are Emanations, endowed with ever-active creative force. We are spirit, non-corporeal, eternal, connected with all other beings. We operate in a material world projected into seeming existence by the ego, and our sole role is to undo the dream of the world, soul by soul, firstly by converting the nightmare into a happy dream, which conversion, when universally complete, will yield the original Light that was and still is the real and only universe.

This brief comparison should  be encouraging.