unity csharp throw exception

Code Example - unity csharp throw exception

                
                        //usual c# syntax should work
throw new Exception(); //remember to include 'using System;'
//alternatively, try this
Debug.LogException(e, this);

//docs for latter: https://docs.unity3d.com/ScriptReference/Debug.LogException.html