- Home /
MonoScript, Type or namespace UnityEditor couldn't be found
Okey so I'm kinda new to Unity. I made a small game and wanted 2DTile (https://www.assetstore.unity3d.com/en/#!/content/4123) in order to make my levels. Now, it seemed to be working fine and I can run it etc etc but the problem is when I try to build it (through Unity), it complains about "Type or namespace UnityEditor couldn't be found..." and I fixed this by adding #if UNITY_EDITOR before the using UnityEditor phrase. Now the problem is that it now complains about MonoScript instead ("Type or namespace MonoScript couldn't be found...").
This is the script that the compiler is using. If someone could point me in the right direction it would be wonderful. It's probably some easy thing I've overseen but I can't figure it out...
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
using System.Collections;
using Mono
public class TileLayer : MonoBehaviour
{
public Vector2 layerSize = new Vector2(20,10);
public Material mat;
public Vector2 tileSize = new Vector2(1,1);
public Vector2 offset = new Vector2(0,0);
public int level = 0;
public bool boxCollider = false;
public bool trigger = false;
public bool makeObject;
public MonoScript script = null;
public bool usePrefab;
public bool showProperties = true;
public bool showPrefab = false;
public int prefabs = 0;
public int prefabIndex = 0;
public int[] prefabSize;
public string[] prefabsName;
public Material[] prefabsMat;
public Vector2[] prefabsTileSize;
public Vector2[] prefabsOffset;
public bool[] prefabBoxCollider;
public bool[] prefabTrigger;
public MonoScript[] prefabScript;
public bool[] prefabMakeObject;
public GameObject tiles;
public GameObject objects;
void OnDrawGizmosSelected()
{
Gizmos.color = Color.white;
Gizmos.DrawLine(new Vector3(0,0,level), new Vector3(layerSize.x,0,level));
Gizmos.DrawLine(new Vector3(0,0,level), new Vector3(0,layerSize.y,level));
Gizmos.DrawLine(new Vector3(layerSize.x,0,level), new Vector3(layerSize.x,layerSize.y,level));
Gizmos.DrawLine(new Vector3(0,layerSize.y,level), new Vector3(layerSize.x,layerSize.y,level));
for (int i = 1; i < layerSize.x; i++)
{
Gizmos.color = Color.grey;
Gizmos.DrawLine(new Vector3(i,0,level), new Vector3(i,layerSize.y,level));
}
for (int i = 1; i < layerSize.y; i++)
{
Gizmos.color = Color.grey;
Gizmos.DrawLine(new Vector3(0,i,level), new Vector3(layerSize.x,i,level));
}
}
}
Line 6:
using $$anonymous$$ono
Get rid of it.
Also, you'll need to wrap any code using $$anonymous$$onoScript in the same #if UNITY_EDITOR
checks, because that class is only present with the UnityEditor namespace.
shouldnt it be TileLayer : Editor not TileLayer : $$anonymous$$onoBeahviour?
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Initialising List array for use in a custom Editor 1 Answer
Editor Windows : Help required 1 Answer
Gizmos icons 0 Answers