# Editor build errors when building from VS

**URL:** <https://qa.fmod.com/t/editor-build-errors-when-building-from-vs/21948>\
**Category:** Unity\
**Tags:** switch\
**Created:** [July 31, 2024, 9:47am UTC](https://qa.fmod.com/t/editor-build-errors-when-building-from-vs/21948 "2024-07-31T09:47:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![IV-Kitti](https://avatars.discourse-cdn.com/v4/letter/i/dec6dc/32.png) [@IV-Kitti](https://qa.fmod.com/u/IV-Kitti)\
**Post date:** [July 31, 2024, 9:47am UTC](https://qa.fmod.com/t/editor-build-errors-when-building-from-vs/21948/1 "2024-07-31T09:47:37Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [August 1, 2024, 2:00am UTC](https://qa.fmod.com/t/editor-build-errors-when-building-from-vs/21948/2 "2024-08-01T02:00:25Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![IV-Kitti](https://avatars.discourse-cdn.com/v4/letter/i/dec6dc/32.png) [@IV-Kitti](https://qa.fmod.com/u/IV-Kitti)\
**Post date:** [August 1, 2024, 7:41am UTC](https://qa.fmod.com/t/editor-build-errors-when-building-from-vs/21948/3 "2024-08-01T07:41:01Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [August 6, 2024, 4:56am UTC](https://qa.fmod.com/t/editor-build-errors-when-building-from-vs/21948/5 "2024-08-06T04:56:41Z")

</div>

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?

> [@IV-Kitti](#):
>
> Do I need to manually add any definitions or am I missing something in my setup?

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?

---

<div class="post-metadata">

**Author:** ![IV-Kitti](https://avatars.discourse-cdn.com/v4/letter/i/dec6dc/32.png) [@IV-Kitti](https://qa.fmod.com/u/IV-Kitti)\
**Post date:** [August 6, 2024, 5:27am UTC](https://qa.fmod.com/t/editor-build-errors-when-building-from-vs/21948/6 "2024-08-06T05:27:24Z")

</div>

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

Thanks for the reply !
