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.
  2. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

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:
    335
    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