Skip to content

Unity Notes

wvdvegt edited this page Nov 5, 2017 · 1 revision

Unity Notes

  • The Bridge in Unity cannot be derived from MonoBehaviour as the data necessary for constructing Paths is not allowed in the Start method. A more safe way is to add a MonoBehaviour property and assign it using a separate constructor. Like:

      private MonoBehaviour behaviour
      {
          get;
          set;
      }
    
      /// <summary>
      /// Initializes a new instance of the asset_proof_of_concept_demo_CSharp.Bridge class.
      /// </summary>
      public Bridge()
      {
          if (!Directory.Exists(StorageDir))
          {
              Directory.CreateDirectory(StorageDir);
          }
      }
    
      public Bridge(MonoBehaviour behaviour) : this()
      {
          this.behaviour = behaviour;
      }
    

Clone this wiki locally