Search Unity

  1. Click here to see what's on sale for the "Best of Super Sale" on the Asset Store
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

CS 1069 Error, Build fail with System.Threading.Timer

Discussion in 'Windows' started by neuecc, May 18, 2014.

  1. neuecc

    neuecc

    Joined:
    Apr 20, 2014
    Posts:
    108
    I use System.Threading.Timer.
    Build Settings changes to "Windows Store Apps"
    and push build button, error and can't compile.

    Message is

    Assets\NewBehaviourScript.cs(16,30): error CS1069: 'Timer' 'System.Threading' ********* 'System.Threading.Timer, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' ***************

    (sorry, my environment, message text is corruption)

    Why? and how to use System.Threading.Timer?

    Repro code:

    void Start() {
    new System.Threading.Timer(null, null, 1, 1).Dispose();
    }
     
  2. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    2,712
    Timer class is not available in Windows Store Apps.
     
  3. neuecc

    neuecc

    Joined:
    Apr 20, 2014
    Posts:
    108
    Thank you.

    By the way, is this limitation by Unity?
    VS2013 + StoreApp or Portable Class Library(.NET .4.5.1 + Windows 8.1) can use Timer.
     
  4. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    7,889
    Hi,

    I think you're right, it's definitely a bug in Unity. The full error message is this:

    Code (csharp):
    1. Assets\NewBehaviourScript.cs(9,7): error CS1070: The type name 'Timer' could not be found. This type has been forwarded to assembly 'System.Threading.Timer, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Consider adding a reference to that assembly.
    2.  
    Could you file a bug?

    In the meantime, you can workaround this by going to player settings and selecting "None" on compilation overrides setting.
     
unityunity