|
|
(同じ利用者による、間の1版が非表示) |
行1: |
行1: |
− | ==Exception例文==
| + | [[Unity/Csharp/Exception/Exception]] |
− | <pre>
| + | |
− | void Exec()
| + | |
− | {
| + | |
− | try
| + | |
− | {
| + | |
− | Hoge();
| + | |
− | }
| + | |
− | catch (Exception e)
| + | |
− | {
| + | |
− | Debug.LogError(e.Message + ": [" + e.StackTrace + "] name:" + e.GetType().Name);
| + | |
− | Debug.LogError(e.Message + " " + e);
| + | |
− | }
| + | |
− | }
| + | |
− | void Hoge()
| + | |
− | {
| + | |
− | throw new Exception("例外エラーNormal");
| + | |
− | }
| + | |
− | </pre>
| + | |
| | | |
− | 出力(e.StatkcTrace)
| + | [[Unity/Csharp/Exception/NullReferenceException]] |
− | <pre>
| + | |
− | at ExceptionScene.HogeAsync () [0x00074] in Assets/Scripts/Scene/ExceptionScene.cs:43
| + | |
− | at Cysharp.Threading.Tasks.CompilerServices.AsyncUniTask`1[TStateMachine].GetResult (System.Int16 token) [0x00000] in ./Library/PackageCache/com.cysharp.unitask@b992a061fb/Runtime/CompilerServices/StateMachineRunner.cs:218
| + | |
− | at ExceptionScene.Exec () [0x00023] in /Assets/Scripts/Scene/ExceptionScene.cs:26
| + | |
− | </pre>
| + | |
− | | + | |
− | 出力(e.Message)
| + | |
− | 例外エラーNormal
| + | |
− | | + | |
− | 出力(e.GetType().Name)
| + | |
− | Exception
| + | |
− | | + | |
− | 出力(e)
| + | |
− | <pre>
| + | |
− | System.Exception: 例外エラーAsync
| + | |
− | at ExceptionScene.HogeAsync () [0x00074] in Assets/Scripts/Scene/ExceptionScene.cs:43
| + | |
− | at Cysharp.Threading.Tasks.CompilerServices.AsyncUniTask`1[TStateMachine].GetResult (System.Int16 token) [0x00000] in ./Library/PackageCache/com.cysharp.unitask@b992a061fb/Runtime/CompilerServices/StateMachineRunner.cs:218
| + | |
− | at ExceptionScene.Exec () [0x00023] in Assets/Scripts/Scene/ExceptionScene.cs:26
| + | |
− | </pre>
| + | |
− | | + | |
− | ==関連==
| + | |
− | [[Unity/クラッシュ]] [ショートカット]
| + | |
2023年10月17日 (火) 15:40時点における最新版
Unity/Csharp/Exception/Exception
Unity/Csharp/Exception/NullReferenceException