Search Unity

Bug Assembly-Csharp-Editor Reference issue.

Discussion in 'Scripting' started by Resourcefool, Jun 3, 2021.

  1. Resourcefool

    Resourcefool

    Joined:
    Apr 16, 2021
    Posts:
    3
    Assembly-Csharp-Editor Reference issue.
    Does anyone know how to fix it? Screenshot (18).png
     
  2. _geo__

    _geo__

    Joined:
    Feb 26, 2014
    Posts:
    1,332
  3. Resourcefool

    Resourcefool

    Joined:
    Apr 16, 2021
    Posts:
    3
    HexCoordinates is a struct created under project root namespace.

    I am learning how to build a Hex Map from this tutorial Hex Map 1 (catlikecoding.com). At part 4.1 <Coordinates in the Inspector>, I followed tutorial but got an error as stated above. I tried to add using MyProjectRoodNameSpace but apparently it doesn't recognize that namespace.

    I have also checked several other similar posts. (Can't properly reference public classes from the Assembly-CSharp into Assembly-CSharp-Editor - Unity Forum) Seems like they got it solved but I don't know what it means by saying Assembly Reference and Definitions files and how to create them exactly.
     
  4. _geo__

    _geo__

    Joined:
    Feb 26, 2014
    Posts:
    1,332
    You can try to recreated the project files for VisualStudio from Unity, it sometimes helps with these errors. It's under Preferences > External Tools > Regenerate project files
     
  5. Resourcefool

    Resourcefool

    Joined:
    Apr 16, 2021
    Posts:
    3
    I tried. Not working. I still think that's some random reference bug since I can't reference any script in my editor project.
     
  6. _geo__

    _geo__

    Joined:
    Feb 26, 2014
    Posts:
    1,332
    Then the only other thing I can think of would be a typo / compile error in the HexCoordinates class. You can try to make a new class and try to import that (just to test if it's a general issue or HexCoordinates specific).
     
  7. Bunny83

    Bunny83

    Joined:
    Oct 18, 2010
    Posts:
    3,981
    Well, first of all, ignore everything that VisualStudio is telling you. Check the errors in Unity. That's the only place that matters. VS is not compiling your code, Unity is. Also when you check the console for errors, ALWAYS fix the top error first. The editor assembly is compiled after the normal runtime assembly has finished compiling. If there's any error in any runtime script the runtime assembly won't be compiled at all and can not be referenced by the editor assembly.

    If you have no error inside Unity at all, the issue may be just the solution / csproj file. Either it's write protected or did not update for whatever reasons.