Search Unity

Resolved The IDEs cannot recognize the UNITY_EDITOR scripting define symbol in the xxx.Player assembly

Discussion in 'Code Editors & IDEs' started by SolarianZ, Jul 26, 2023.

  1. SolarianZ

    SolarianZ

    Joined:
    Jun 13, 2017
    Posts:
    237
    I have noticed that there are always two types of runtime assemblies generated by Unity, one of which has the suffix .Player. However, the IDE cannot recognize the
    UNITY_EDITOR
    symbol in the assembly with the .Player suffix.

    For example, Visual Studio can recognize the
    UNITY_EDITOR
    symbol in Assembly-CSharp, but cannot recognize the
    UNITY_EDITOR
    symbol in Assembly-CSharp.Player (the code is displayed in gray):
    upload_2023-7-26_10-56-51.png
    upload_2023-7-26_10-57-23.png

    This issue is particularly severe for Rider. Because Rider displays the Unity resource structure by default instead of the Solution resource structure, the code wrapped in the UNITY_EDITOR symbol is always gray:
    upload_2023-7-26_10-57-53.png
     
  2. van800

    van800

    JetBrains Employee

    Joined:
    May 19, 2016
    Posts:
    73
    In Rider there is a context switch in the bottom of the text control, which allows you to switch between Player and non-Player csproj, when some file exists in both of them.
     
    SolarianZ likes this.
  3. SolarianZ

    SolarianZ

    Joined:
    Jun 13, 2017
    Posts:
    237
    This is very helpful, thank you!

    Has Rider considered setting the non-Player csproj as the default context? After all, in development, most of the time we need to focus on those editor code.
     
    van800 likes this.
  4. van800

    van800

    JetBrains Employee

    Joined:
    May 19, 2016
    Posts:
    73