unity throw exception code example
Example: unity c# 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