I need help just understanding how to do this. I’ve been working on Unity Learn, Junior Programmer pathway, and I’m currently on Mission 3. I’m stuck on this tutorial, “Create a scene flow”, and on this part, “Add a new namespace”. Basically, this is the code I need help on:
if (UNITY_EDITOR)
{
using UnityEditor;
}
The tutorial said for it to be set up at the end of all the name spaces, and I set it up that way, and It wasn’t working. I’ve also tried other stuff, but it also didn’t work. Whenever I look at my project in Unity, it says there’s a error to the script, in that specific area. I just want to fix this so that I can playtest my project.
Thank you.
Other info
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.SceneManagement;
if (UNITY_EDITOR)
{
using UnityEditor;
}
// Sets the script to be executed later than all default scripts
// This is helpful for UI, since other things may need to be initialized before setting the UI
[DefaultExecutionOrder(1000)]
public class MenuUIHandler : MonoBehaviour
{
public ColorPicker ColorPicker;
public void NewColorSelected(Color color)
{
// add code here to handle when a color is selected
}
private void Start()
{
ColorPicker.Init();
//this will call the NewColorSelected function when the color picker have a color button clicked.
ColorPicker.onColorChanged += NewColorSelected;
}
public void StartNew()
{
SceneManager.LoadScene(1);
}
public void Exit()
{
if (UNITY_EDITOR)
{
EditorApplication.ExitPlaymode();
}
else
{
Application.Quit();
}
}
}