Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question Cant build the project because of the editor use

Discussion in 'AI & Navigation Previews' started by ChernyshellyRUS, Feb 20, 2022.

  1. ChernyshellyRUS

    ChernyshellyRUS

    Joined:
    Oct 8, 2021
    Posts:
    2
    I try to build my project but get 117 errors from Editor folder of the asset
    Unity version 2020.3.25f1
    upload_2022-2-20_14-58-15.png
    I know that editor doesnt exist during build, but I dont understand how to fix it. Everything works fine in the editor.
    Here is my NavMeshSurface object
    upload_2022-2-20_15-4-30.png
     
  2. BachmannT

    BachmannT

    Joined:
    Nov 20, 2016
    Posts:
    360
    It's because you are using API available only in the editor, so when building they can't be found.
    Unity create 2 projects in the solution:
    upload_2022-2-20_17-59-7.png
    Check your code in the first, and removes all references to API using UnityEditor.
    search "using UnityEditor;" in C#
     

    Attached Files:

  3. ChernyshellyRUS

    ChernyshellyRUS

    Joined:
    Oct 8, 2021
    Posts:
    2
    I'm not using UnityEditor. NavMeshComponents do. They have folder named Editor where every script uses UnityEditor. How do I use NavMeshComponents without this folder? My AI just stops working without that folder.
    Here are my projects, you can see the Editor folder exists only in NavMeshComponentsEditor project
    upload_2022-2-21_14-24-33.png
    upload_2022-2-21_14-24-58.png