Search Unity

Compile Error - The name 'EditorUtility' does not exist in the current context

Discussion in 'Editor & General Support' started by tillsanta1034, May 18, 2019.

  1. tillsanta1034

    tillsanta1034

    Joined:
    Nov 22, 2018
    Posts:
    1
    Hello,
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEditor;
    5.  
    6. public class test : MonoBehaviour
    7. {
    8.     // Start is called before the first frame update
    9.     void Start()
    10.     {
    11.         string path = EditorUtility.OpenFilePanel("", "", "");
    12.     }
    13.  
    14.    
    15.    
    16. }
    17.  
    When I build this code, I get a complie errors :
    Assets\test.cs(11,23): error CS0103: The name 'EditorUtility' does not exist in the current context

    But when I Play this code, I get 0 error.
    Thanks for the help :) !
     
    JellySkazzel likes this.
  2. jolanaklin

    jolanaklin

    Joined:
    Apr 14, 2019
    Posts:
    2
    Last edited: Aug 11, 2019
  3. lahcenchakpro

    lahcenchakpro

    Joined:
    Apr 29, 2020
    Posts:
    1
    Please can you tel me exactely wich one of the method you had use, thanks