unity, GUIStyle and Skin

例1:

using UnityEngine;

using System.Collections;

using UnityEditor;

using System.Collections.Generic;

[CustomEditor(typeof(CmyScriptableObject))]

 

public class myScriptableObjectCustomEditor : Editor 

{

  public Vector2 scrollPosition = Vector2.zero;

  public int selGridInt = 0;

  public string[] selStrings = new string[] {"item1", "item2", "item3", "item4", "item5", "item6", "item7", "item8"};

  public override void OnInspectorGUI()

  {

    DrawDefaultInspector ();

    CmyScriptableObject data = CmyScriptableObject)target;

    scrollPosition = EditorGUILayout.BeginScrollView (scrollPosition,"box",GUILayout.MaxHeight(90));

    {

      //ref: http://answers.unity3d.com/questions/37223/how-do-i-center-a-gui-label.html

      //ref: http://iaimstar.iteye.com/blog/2222128

      GUIStyle _style = GUI.skin.GetStyle ("MenuItemMixed");

      selGridInt = GUILayout.SelectionGrid(selGridInt, selStrings, 1,_style);

    }

    EditorGUILayout.EndScrollView ();

  }

}

例2:

using UnityEngine;

using System.Collections;

using UnityEditor;

using System.Collections.Generic;

[CustomEditor(typeof(CmyScriptableObject))]

 

public class myScriptableObjectCustomEditor : Editor 

{

  public Vector2 scrollPosition = Vector2.zero;

  public int selGridInt = 0;

  public string[] selStrings = new string[] {"item1", "item2", "item3", "item4", "item5", "item6", "item7", "item8"};

  public override void OnInspectorGUI()

  {

    DrawDefaultInspector ();

    CmyScriptableObject data = CmyScriptableObject)target;

    scrollPosition = EditorGUILayout.BeginScrollView (scrollPosition,"box",GUILayout.MaxHeight(90));

    {

      //ref: http://answers.unity3d.com/questions/37223/how-do-i-center-a-gui-label.html

      //ref: http://iaimstar.iteye.com/blog/2222128

      GUIStyle _style = GUI.skin.GetStyle ("helpbox");
        _style.onNormal.textColor=Color.blue;

      selGridInt = GUILayout.SelectionGrid(selGridInt, selStrings, 1,_style);

    }

    EditorGUILayout.EndScrollView ();

  }

}

 

自定义skin教程:http://forum.unity3d.com/threads/creating-custom-gui-skins-part-one.113055/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Unity是一款强大的跨平台游戏引擎,也可以用于开发其他类型的应用程序。Unity提供了一个名为Unity Graph and Chart的工具,用于创建和展示图形和图表。 Unity Graph and Chart工具使用户能够在游戏或应用程序中轻松地创建和管理各种类型的图表,例如柱状图、饼状图、折线图等。它提供了一个直观的界面,使用户能够通过简单的拖拽和放置操作来生成图表。 使用Unity Graph and Chart,用户可以根据自己的需求自定义图表的样式和外观。它提供了丰富的样式选项,例如改变图表的颜色、调整坐标轴的格式、选择不同的图例样式等。用户还可以通过编程的方式动态地更新图表数据,使其能够实时反映应用程序中的变化。 除了基本的图表功能,Unity Graph and Chart还提供了一些额外的特性和工具来增强用户体验。例如,它可以支持多种不同的数据源,如数据库和网络数据。它还提供了一些交互式的功能,如放大、缩小、拖动等,使用户能够更好地探索图表数据。 最后,Unity Graph and Chart工具还具有良好的跨平台性能。无论是在PC、移动设备还是VR/AR设备上,都可以运行流畅,并且能够适应不同的屏幕分辨率和设备特性。 总之,Unity Graph and Chart是一个功能强大且易于使用的工具,可帮助用户在Unity引擎中创建和展示各种类型的图表。无论是用于游戏开发还是其他应用程序开发,都可以通过这个工具来有效地展示和分析数据。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值