Search Unity

Bug in the compile (due to a syntax error)

Discussion in 'Scripting' started by Novusis, Jan 19, 2019.

  1. Novusis

    Novusis

    Joined:
    Jan 2, 2016
    Posts:
    2
    How can I tell about a bug in the compile (due to a syntax error) that causes the unit to be turned off without saving?
    where better to write about this, in which section of the site?
     
  2. GroZZleR

    GroZZleR

    Joined:
    Feb 1, 2015
    Posts:
    3,201
    If you mean you're found a bug that's causing the editor to crash, follow these steps: https://unity3d.com/unity/qa/bug-reporting

    I'd be curious to see what sort of syntax error would crash the entire editor though. Can you share the code in question?
     
    Novusis likes this.
  3. Novusis

    Novusis

    Joined:
    Jan 2, 2016
    Posts:
    2
    thanks
    Code (CSharp):
    1.     public int Coins
    2.     {
    3.         get { return Coins; }
    4.         set
    5.         {
    6.             Coins = value;
    7.         }
    8.     }
     
  4. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,735
    Stack overflow error I'm guessing.

    Change it to this
    Code (CSharp):
    1.  
    2.  
    3.     private int _coins;
    4.     public int Coins
    5.     {
    6.         get { return _coins; }
    7.         set
    8.         {
    9.             _coins = value;
    10.         }
    11.     }
    or
    Code (CSharp):
    1.  
    2.  
    3.     public int Coins
    4.     {
    5.         get;
    6.         set;
    7.     }
    either one should fix the problem.
     
    Last edited: Jan 19, 2019
    GroZZleR likes this.