This is considered unprofessional while performing in front of an audience or camera (except when the act is a deliberate breaking of the fourth wall).
British English uses a slang term, corpsing, to specifically describe one of the most common ways of breaking character—when an actor loses their composure and laughs or giggles inappropriately during a scene.
The advent of DVD players, with the use of their precise pause and slow-motion functions, has made it far easier to spot breaks in character in motion pictures, and many internet sites collect such examples.
Breaking character is not solely limited to performances in traditional theater, television, and film; the phenomenon is not unheard of in professional wrestling, which is normally highly scripted.
In Ruggero Leoncavallo's opera Pagliacci, commedia dell'arte actor Canio kills his real-life wife and her lover onstage.