Editor build errors when building from VS

Hi,

Building the project from Unity works but when I try to build from visual studio I get many build errors what wouldn’t happen if

#if UNITY_EDITOR

was defined, am I missing something or should I manually add them ?

Hi,

What version of the FMOD integration are you using? Could you please further explain the issue I am not sure I understand. What are you trying to build from VS? Any information you can share will be greatly appreciated.

Thanks for your response. I’m using FMOD Studio 2022.2 with Switch SDK 17.5.3 in Unity.

To clarify the issue:

  1. I can build and launch directly for the Switch platform from Unity, but the game crashes.
  2. I’m trying to build the project from Visual Studio so I can debug and get a callstack for this crash.
  3. Other platforms compile from VS without issues, but Switch is causing problems.

For example the UNITY_EDITOR directive, I’ve noticed some potential inconsistencies:

  • In FMOD\src\Editor\EditorSettings.cs:444, there’s a method:
    public bool CanBuildTarget(BuildTarget target, Platform.BinaryType binaryType, out string error)
  • BinaryType is defined in Platform only if UNITY_EDITOR and is properly guarded in FMOD\src\Platform.cs

I’m curious if these inconsistencies might be related to the Switch-specific issues I’m seeing. Do I need to manually add any definitions or am I missing something in my setup?

Any guidance on resolving this would be greatly appreciated.

1 Like

Thank you for the explanation and the information.

The issue may be calling any functions from classes in the FMOD\src\Editor from your code, possibly the CanBuildTarget() function. Could you try removing this function in your code or surrounding it with a #if UNITY_EDITOR check to ensure it is only called when in the Unity Editor?

Hopefully, removing the Editor functions or surrounding them in #if calls will help.

If this still does not solve the issue, would it be possible to share the VS output?

Ok so I have to do it manually, there a bunch them but so be it.

Thanks for the reply !

1 Like