Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

The type `UnityEngine.Object' has been forwarded to an assembly that is not referenced

Discussion in 'Editor & General Support' started by Stranger-Games, Oct 3, 2018.

  1. Stranger-Games

    Stranger-Games

    Joined:
    May 10, 2014
    Posts:
    393
    Hi,

    I'm compiling my own dll using CSharpCodeProvider. Things were working but I was getting the warning



    So I excluded all the modules from the assembly references, but then I got compilation errors like those.

    Code (CSharp):
    1. Error Number: CS1070, 'The type `UnityEngine.Object' has been forwarded to an assembly that is not referenced. Consider adding a reference to assembly `UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
    2. Error Number: CS1070, 'The type `UnityEngine.AudioClip' has been forwarded to an assembly that is not referenced. Consider adding a reference to assembly `UnityEngine.AudioModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
    Lastly I noticed that the csproj file generated by Unity contains direct references to modules, should I do the same?



    Thanks for advance.
     
  2. madgreg

    madgreg

    Joined:
    Aug 29, 2013
    Posts:
    35
    Hello, have you found a workaround on this? I'm having the same troubles
     
  3. Giometric

    Giometric

    Joined:
    Dec 20, 2011
    Posts:
    170
    You'll still need to reference the 'forwarding' DLLs, which sit one level above that folder, inside the "Managed" folder:
    • Data/Managed/UnityEngine.dll
    • Data/Managed/UnityEditor.dll (for any external DLLs that need Editor stuff)
    Also, make sure you're compiling for the same target that your Unity project is set to (.NET 4.x vs .NET Standard 2.0)
     
  4. Baltrisch

    Baltrisch

    Joined:
    Nov 9, 2013
    Posts:
    2
    i'm having this warning to, and besides the warning icon, it actually don't let me compile

    i tried with only Data/Managed/UnityEngine.dll
    but some classes are not there

    i've tried with the modules, the dll compile, but unity does not accept it because of reference