duck

script to test error types

May 25th, 2012
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.83 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class Test : MonoBehaviour {
  5.    
  6.     Object nullObject;
  7.     bool secondError = false;
  8.    
  9.     // Use this for initialization
  10.     void Start () {
  11.    
  12.         Debug.Log("Regular Log Line");
  13.         Debug.LogWarning("This is a log warning");
  14.         Debug.LogError("This is a log error");
  15.         FunctionA ();
  16.        
  17.        
  18.         nullObject.name = "this will fail!";
  19.        
  20.     }
  21.    
  22.     void FunctionA() {
  23.    
  24.         FunctionB(1);
  25.        
  26.     }
  27.    
  28.     void FunctionB(int n) {
  29.    
  30.         FunctionC();
  31.        
  32.     }
  33.    
  34.     void FunctionC() {
  35.    
  36.         Debug.Log ("This line is a few functions deep");
  37.        
  38.     }
  39.    
  40.     // Update is called once per frame
  41.     void Update () {
  42.         if (!secondError)
  43.         {
  44.             secondError = true;
  45.             FunctionD ();
  46.         }
  47.     }
  48.    
  49.     void FunctionD() {
  50.         FunctionE();   
  51.     }
  52.    
  53.     void FunctionE() {
  54.         nullObject.name = "this will fail too!";   
  55.     }
  56.    
  57. }
Advertisement
Add Comment
Please, Sign In to add comment