Illusion vs. Reality is central to Shakespeare's Hamlet. The theme is nearly constant in the play.
The Ghost appears to be that of King Hamlet, but it uses the trap door (suggesting hell in Elizabethan theatre) and disappears at sunrise, as if its evil and can only come out at night. And Hamlet needs to know for sure before he does something as momentous as kill a king.
Gertrude says Hamlet "seems" to be still upset at his father's death, igniting Hamlet's "Seems, madam" speech, in which Hamlet declares that his melancholy (depression) isn't just for the sake of appearances, but is real. Yet, later, Hamlet will fake madness (insanity), and speculation will result about whether his madness is real or illusion.
Ophelia, Polonius, Rosencrantz and Guildenstern all pretend to be doing things other than what they are really doing: spying on Hamlet.
Claudius pretends to be a just and caring ruler and father, but is neither. He pretends to send Hamlet to England for recuperation purposes, when he's really sending him to be executed. He even talks Laertes into pretending, leading Laertes into treachery.
And, of course, the play within the play draws attention to all the seeming and acting and role playing, and what appears to be a simple night's entertainment is really the thing by which Hamlet will "catch the conscience of the king."
Hamlet is a just and moral human trapped in an unjust and corrupt world. A large part of his task is to determine who else is just and moral, and who else is just pretending. The only time reality is truly apparent in the play is in the final scene, when just about everybody is dead.