Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice

Windows 10 and .NET Framework 3.5

Discussion in 'Scripting' started by ewermor, Nov 22, 2015.

  1. ewermor

    ewermor

    Joined:
    Oct 19, 2014
    Posts:
    53
    Hello !

    I switched from Windows 8 to Windows 10 recently and when i have opened my current project, i have noticed that coroutines doesn't work anymore : in MonoDevelop "IEnumerator" is not recognized.

    I think this is due to the version of .NET Framework : the 3.5 version is not activated. But when i enable it i get an error message : "the function attempted to use a name that is reserved to use by another transaction".

    So, can i dispense this version of .NET to use IEnumerator ? Or do you know a solution to enable .NET Framework 3.5 on windows 10 ?

    Thanks !
     
  2. lordofduct

    lordofduct

    Joined:
    Oct 3, 2011
    Posts:
    8,527
    I'm on Win10, but I usually use Visual Studio. Let me check MonoDevelop.

    :: opens MonoDevelop, types IEnumerator ::

    works for me.

    Are you sure the code file has the 'System.Collections' namespace imported?

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. public class MyClass : MonoBehaviour
    6. {
    7.  
    8. //......
    9.  
    I say, because IEnumerator has not been removed from .Net. And the version of windows you're on doestn't effect what is available... it's the version of .Net you're using that changes what's available. And with that said, Microsoft seldom removes things from the framework, only really adding things (there's some exceptions of course). That way the frameworks remain backwards compatible.
     
  3. ewermor

    ewermor

    Joined:
    Oct 19, 2014
    Posts:
    53
    Thank you for responding.

    Yes System.Collections namespace is imported.
    I see that the lists are not recognized either.

    On this topic http://forum.unity3d.com/threads/ienumerator-seems-not-to-be-recognized-by-the-editor.240368/ someone say : "You've probably solved this by now, but if not, I have had that problem before. I was using the latest .net framework and I went to Programs and Features within control panel (if you're using Windows) and selected the box to also run .net framework 3.5 I think it was.

    I then shut down my project after saving, restarted my machine and it worked fine."
     
  4. lordofduct

    lordofduct

    Joined:
    Oct 3, 2011
    Posts:
    8,527
    Did you try that?
     
  5. ewermor

    ewermor

    Joined:
    Oct 19, 2014
    Posts:
    53
    Yes i did ! And get the error message "the function attempted to use a name that is reserved to use by another transaction".
     
  6. lordofduct

    lordofduct

    Joined:
    Oct 3, 2011
    Posts:
    8,527
    It appears you don't have .net 3.5 installed at all, like it's nowhere on your system.

    You can try installing it.
    https://www.microsoft.com/en-us/download/details.aspx?id=22

    Or better, and what I'd do because I don't like MonoDevelop. Is install Visual Studio.

    It's free:
    https://www.visualstudio.com/en-us/products/visual-studio-community-vs.aspx

    It should install .net 3.5 when you install it. And srsly, it's a lot better than MonoDevelop.




    I honestly don't know why MonoDevelop is complaining like this... 1) newer versions of .net have IEnumerator as well... and 2) doesn't MonoDevelop use Mono? I don't use MonoDevelop, so... :: shrugs ::
     
  7. ewermor

    ewermor

    Joined:
    Oct 19, 2014
    Posts:
    53
    I have tried to install it yet. And i have Visual studio since i use Unity 5, so i tried also.

    Visual studio ask me if i want dowload and install 3.5 or if i want switch to 4.5. If i chose the first option, i get the same problem. If i chose the second, it seem to switch to 4.5 but coroutines doesn't work again and when i restart Unity and restart VS, Visual Studio ask me again...

    I'll search more about switching to 4.5.
     
  8. ewermor

    ewermor

    Joined:
    Oct 19, 2014
    Posts:
    53
    The solution switch automaticly to 3.5 when i start Unity ... Are you sure your projects are not set up on 3.5 ? Maybe Unity have an option for .NET version ...
     
  9. ewermor

    ewermor

    Joined:
    Oct 19, 2014
    Posts:
    53
    Ok, i have tried again and succeeded to install 3.5 ... I think i have downloaded the wrong .NET Framework (the 8+ thinking that mean windows 8 and up), so if you have the same problem on windows 10, take this version : https://www.microsoft.com/en-us/download/confirmation.aspx?id=22

    Thank you for your help lordofduct !
     
  10. lordofduct

    lordofduct

    Joined:
    Oct 3, 2011
    Posts:
    8,527
    How are you opening your project?

    If you're opening the project through Unity, it should not be asking you to switch the project to 4.5. Unity targets a much older version of mono, you can't use the features in 4.5.


    edit:

    aww, see you fixed it. Nevermind this.