示例#1
0
    void OnGUI()
    {
        GUILayout.Label("                                  Creador de luces", EditorStyles.boldLabel);
        GUI.DrawTexture(GUILayoutUtility.GetRect(50, 120), (Texture2D)Resources.Load("foco"));
        name            = EditorGUILayout.TextField("Name", name);
        op              = (options)EditorGUILayout.EnumPopup("Light Type", op);
        bounceintensity = EditorGUILayout.FloatField("Bounce Intencity", bounceintensity);
        spot            = EditorGUILayout.FloatField("Spot Angle", spot);
        intensity       = EditorGUILayout.FloatField("Intensidad", intensity);
        color           = EditorGUILayout.ColorField("color", color);
        Rect rectOpenNew = EditorGUILayout.BeginHorizontal("Button");

        if (GUI.Button(rectOpenNew, GUIContent.none))
        {
            lc                 = ScriptableObjectUtility.CreateAssetAndReturn <LightsConfig>();
            lc.name            = name;
            lc.bounceIntencity = bounceintensity;
            lc.spotValor       = spot;
            lc.intensity       = intensity;
            lc.color           = color;
            instantiateop(op);
            lc.type = luz;
            GameObject light = new GameObject(name);
            light.AddComponent <Light>();
            light.GetComponent <Light>().bounceIntensity = bounceintensity;
            light.GetComponent <Light>().spotAngle       = spot;
            light.GetComponent <Light>().intensity       = intensity;
            light.GetComponent <Light>().color           = color;
            light.GetComponent <Light>().type            = luz;
        }

        GUILayout.Label("create light");
        EditorGUILayout.EndHorizontal();
    }