Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
michaelm9945's avatar
10 years ago

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?

4 Replies

Replies have been turned off for this discussion
  • 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.
  • 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?
  • 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");
    }
    }