Skip to main content
Up and Coming
March 4, 2015

I have a problem with Unity

I made my first game a couple weeks ago and now I've made my 2nd game, but I can't build it to my desktop

When I choose to "build setting" and I choose to save the exe to my desktop, it starts by "compiling Script" and it stays like that for about 1 minute, and then the "build player box" disappears.

The reason for this is because "Error building Player because scripts had compiler errors"

Can somebody help?
    This topic has been closed for replies.

    4 replies

    Participant
    March 4, 2015
    There's a bug in the script that needs fixing. You'll want to find which script is causing the problem.

    You may be able to double click the message to show you the script that has the problem. Or you can go to the "Console" window and see the error messages there.
    ------ DK2's with: Win 7, Win 8.1, Kinect V2, Leap Motion, iMac, GTX970, GTX980, Titan GTX.
    Up and Coming
    March 4, 2015
    This is the error

    "Assets/FliesSystem/Scripts/Drawers/MinMaxSliderDrawer.cs(2,7): error CS0246: The type or namespace name `UnityEditor' could not be found. Are you missing a using directive or an assembly reference?"

    How do I fix this?
    Up and Coming
    March 4, 2015
    This is the script that has a compiling error "MinMaxSliderDrawer"




    using UnityEngine;
    using UnityEditor;

    [CustomPropertyDrawer (typeof (MinMaxSliderAttribute))]
    class MinMaxSliderDrawer : PropertyDrawer {

    public override void OnGUI (Rect position, SerializedProperty property, GUIContent label) {

    if (property.propertyType == SerializedPropertyType.Vector2)
    {
    Vector2 range = property.vector2Value;
    float min = range.x;
    float max = range.y;
    MinMaxSliderAttribute attr = attribute as MinMaxSliderAttribute;

    EditorGUI.BeginChangeCheck ();
    EditorGUILayout.BeginHorizontal();
    EditorGUI.MinMaxSlider (label, new Rect(position.x,position.y,position.width - 106,position.height), ref min, ref max, attr.min, attr.max);
    if (EditorGUI.EndChangeCheck ())
    {
    range.x = min;
    range.y = max;
    property.vector2Value = range;
    }
    EditorGUI.TextField(new Rect(position.x + position.width-50,position.y,50,position.height),range.y.ToString("0.00"));
    EditorGUI.TextField(new Rect(position.x + position.width-102,position.y,50,position.height),range.x.ToString("0.00"));
    EditorGUILayout.EndHorizontal();

    } else {
    EditorGUI.LabelField (position, label, "Use only with Vector2");
    }
    }
    Inspiring
    March 4, 2015
    Seems you are not supposed to be able to build out with the UnityEditor directive.

    See here: http://answers.unity3d.com/questions/57 ... ditor.html
    AMD Ryzen 7 1800X | MSI X370 Titanium | G.Skill 16GB DDR4 3200 | EVGA SuperNOVA 1000 | Corsair Hydro H110i Gigabyte RX Vega 64 x2 | Samsung 960 Evo M.2 500GB | Seagate FireCuda SSHD 2TB | Phanteks ENTHOO EVOLV