Can I use C# exceptions when Fast but no exception optimization is turned on ?
EDIT: Test Code
using UnityEngine;
using System.Collections;
using System;
public class TestException : MonoBehaviour {
private string exceptionMessage;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void GenerateExceptionRandomly()
{
int a = UnityEngine.Random.Range(0, 2);
if (a != 0)
{
throw new ApplicationException("Exception");
}
}
void OnGUI()
{
GUILayout.BeginVertical();
if (exceptionMessage != null)
{
GUILayout.Label(exceptionMessage);
}
else
{
GUILayout.Label("No exception");
}
if (GUILayout.Button("Reset exception", GUILayout.Width(200), GUILayout.Height(50)))
{
exceptionMessage = null;
}
if (GUILayout.Button("Random exception", GUILayout.Width(200), GUILayout.Height(50)))
{
try
{
GenerateExceptionRandomly();
}
catch (Exception e)
{
exceptionMessage = e.StackTrace;
}
}
GUILayout.EndVertical();
}
}