Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by ThisSuperhero · Sep 03, 2014 at 07:27 PM · c#editornamespacegizmos

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));
     }
 }

}

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image rutter · Sep 03, 2014 at 07:25 PM 1
Share

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.

avatar image everett24 · Sep 03, 2014 at 09:28 PM 0
Share

shouldnt it be TileLayer : Editor not TileLayer : $$anonymous$$onoBeahviour?

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

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


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges