text unity3d中ui_unity ui text - CSDN
精华内容
参与话题
  • Unity3D UI Text得分数字增加

    千次阅读 2018-11-23 16:26:08
    Unity3D UGUI Text得分数字增加 代码 一、首先在Hierarchy创建Text组建,并绑定脚本。 using UnityEngine; using System.Collections; using UnityEngine.UI; public class Score : MonoBehaviour { ...

    Unity3D UGUI Text得分数字增加 代码

    在这里插入图片描述
    一、首先在Hierarchy中创建Text,并绑定脚本。

    using UnityEngine;
    using System.Collections;
    using UnityEngine.UI;				**//导入资源库**
    
    public class Score : MonoBehaviour {
    	public static Text txt;				**//定义静态变量名以用于其他脚本内的引用**
    	public static float x = 0;
    	void Start () 
    	{
    		txt = GameObject.Find ("Text").GetComponent<Text> ();	 
    	}
    }
    
    

    二、在确定变量名指定的组建后,对得分时情况进行判断。这里进入判断绑定刚体是否碰撞的脚本。

    using UnityEngine;
    using System.Collections;
    
    public class collision2 : MonoBehaviour {
    	public GameObject bullet;	
    
    	void OnCollisionEnter(Collision col)				**//当刚体碰撞开始时**
    	{
    		if (col.gameObject.name.Equals ("Bullet(Clone)")) 
    		{
    			Instantiate (bullet,col.transform.position,Quaternion.identity);
    			Destroy(col.gameObject);  
    			Score.x += 1;				**//刚体碰撞结束后得分加1**
    			Score.txt.text = "Score : " + Score.x;				//在text文本中显示Score : x
    		}
    	}
    

    总结:这里的代码示例是以制定刚体碰撞的开始时,进行得分判断。当Bullet(Clone)与脚本绑定的刚体碰撞,便得分数 X+1 ,并在Score脚本中的txt中加上转换成文本类型后的X。

    展开全文
  • Unity 3D - UGUI 设置Text组件文本颜色

    千次阅读 2017-04-23 22:28:22
    Unity 3D - 设置Text控件文本颜色 :效果图 : 通过颜色赋值 艾利的天镜 通过颜色表色码赋值 注意 : 要加# . 玩具</color> unity提供下列颜色可以选择 :颜色色码表 :

    Unity 3D - UGUI 设置Text组件文本颜色 :

    效果图 :

    这里写图片描述

    这里写图片描述

    • 通过颜色赋值
    <color=blue>艾利的天镜</color>
    • 通过颜色表色码赋值
      注意 : 要加# .
    <color=#5cacee>玩具</color> 

    unity提供下列颜色可以选择 :

    这里写图片描述

    颜色色码表 :

    这里写图片描述

    展开全文
  • Unity3D UI Text文本触发隐藏显示

    万次阅读 2018-11-23 16:26:00
    一、首先创建一个脚本,并绑定在对应的text中。 二、定义变量,并使文本保持隐藏 using UnityEngine; using System.Collections; using UnityEngine.UI; **//导入UI资源库** public class die : ...

    Text文本显示/隐藏

    一、首先创建一个脚本,并绑定在对应的text中。

    在这里插入图片描述

    二、定义变量,并使文本保持隐藏

    using UnityEngine;
    using System.Collections;
    using UnityEngine.UI;				**//导入UI资源库**
    
    public class die : MonoBehaviour 
    {
    	public static GameObject txt;				**//定义公共静态变量用于另外脚本的引用**
    
    	void Start () 
    	{
    		txt = GameObject.Find("die");
    		txt.SetActive (false);				**//保持txt的隐藏状态**
    	}
    }
    
    

    三、接下来进入另一个脚本,使玩家碰到指定物体时,显示文本

    using UnityEngine;
    using System.Collections;
    
    public class collision1 : MonoBehaviour {
    
    	private GameObject man;
    
    	void OnCollisionEnter(Collision col)				
    	{
    		if (col.gameObject.name.Equals ("prop_samoflange(Clone)")) 				**//当碰撞开始时**
    		{
    			die.txt.SetActive(true);				**//文本显示**
    		}
    

    首先文本利用SetActive函数控制其隐藏,当利用OnCollisionEnter方法,检测到物体碰撞时,显示文本。

    展开全文
  • Unity3D基础UI框架,Unity MVVM

    万次阅读 2020-03-06 14:20:17
    之前学了刘国柱老师的UI框架加上我自己的理解做了一个UI框架正好可以使用 这里附上刘国柱老师的博客http://www.cnblogs.com/LiuGuozhu/ 受益颇深 基本UI框架的类图就是这样了 大体是根据MVC加上我的魔改而成...

    最新:

    参考公司lua的mvvm写了一个c#版的,https://github.com/so-sos-so/SoF,欢迎提建议

    后续会新开一篇文章补充开发思路

    ------------------------------弃用---------------------------------

    之前学了刘国柱老师的UI框架加上我自己的理解做了一个UI框架正好可以使用

    这里附上刘国柱老师的博客 http://www.cnblogs.com/LiuGuozhu/ 受益颇深

    基本UI框架的类图就是这样了

    大体是根据MVC加上我的魔改而成的框架,至少我自己暂时觉得还是思路挺清晰的

    Panel的切换是使用的Canvas Group的更改透明度,在加上使用

    此方法来更改显示顺序和显隐的

    其中的界面反向切换是使用的栈后入先出的特性

    反向切换是指一个窗口弹出小窗口后,父窗口的Raycast需要取消,下面贴上核心代码

    using System.Collections;
    using System;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.UI;
    
    public class UIManager :MonoBehaviour {
    
        /// <summary>
        /// 单例模式:
        /// 1.定义一个静态的对象 在外界访问 内部构造
        /// 2.构造方法私有化
        /// </summary>
        #region 单例模式
    
        private static UIManager _instance;
    
        public static UIManager Instance
        {
            get
            {
                if (_instance == null)
                {
                    UIManager[] instances = FindObjectsOfType<UIManager>();
                    if (instances != null)
                    {
                        _instance = instances[0];
                        for (var i = 1; i < instances.Length; i++)
                        {
                            Destroy(instances[i].gameObject);
                        }
                    }
                }
                return _instance;
            }
        }
    
        #endregion
    
    
        private Transform _canvas;
        public Transform Canvas
        {
            get
            {
                if (_canvas == null)
                    _canvas = GameObject.Find("Canvas").transform;
                return _canvas;
            }
        }
        //存储所有面板prefab的地址
        private Dictionary<UIPanelType, string> _DicPanelPath;
        //存储所有实例化的面板身上的BasePanel组件
        private Dictionary<UIPanelType, BasePanel> _DicPanel;
        //存储所有显示的面板上的BasePanel组件
        private Dictionary<UIPanelType, BasePanel> _DicShowPanel;
        //表示显示面板的栈
        private Stack<BasePanel> _StackPanel;
        //全屏显示的节点
        private Transform _TraFullScreen = null;
        //固定显示的节点
        private Transform _TraFixed = null;
        //弹出节点
        private Transform _TraPopUp = null;
        脚本节点
        //private Transform _TraScript = null;
    
    
        private void Awake()
        {
            ParseUIPanelPathJson();
            _StackPanel = new Stack<BasePanel>();
            _DicPanel = new Dictionary<UIPanelType, BasePanel>();
            _DicShowPanel = new Dictionary<UIPanelType, BasePanel>();
            _TraFullScreen = Canvas.Find("FullScreen");
            _TraFixed = Canvas.Find("Fixed");
            _TraPopUp = Canvas.Find("PopUp");
            DontDestroyOnLoad(Canvas.gameObject);
            //_TraScript = Canvas.Find("Script");
        }
    
    
    
        /// <summary>
        /// 把类型为反向切换的窗体入栈
        /// </summary>
        /// <param name="type"></param>
        private void PushPanel(UIPanelType type)
        {
            BasePanel basePanel = GetPanel(type);
            if (_StackPanel.Count >= 1)
            {
                BasePanel topPanel = _StackPanel.Peek();
                topPanel.OnPause();
            }
            _StackPanel.Push(basePanel);
            basePanel.OnEnter();
        }
    
        /// <summary>
        /// 把类型为反向切换的窗体出栈
        /// </summary>
        /// <param name="type"></param>
        private void PopPanel(UIPanelType type)
        {
            //如果栈里面为空,则返回
            if (_StackPanel.Count <= 0) return;
            BasePanel basePanel = GetPanel(type);
            BasePanel topPanel = _StackPanel.Peek();
            //如果当前要出栈的界面跟栈顶界面相同时 才会出栈
            if(basePanel.gameObject == topPanel.gameObject)
            {
                _StackPanel.Pop();
                topPanel.OnExit();
                //如果出栈后栈里面还有界面则恢复
                if(_StackPanel.Count >= 1)
                {
                    _StackPanel.Peek().OnResume();
                }
            }
            else
            {
                Debug.LogError("栈顶界面不是此界面,请检查进出栈!!");
            }
            
        }
    
        /// <summary>
        /// 显示界面
        /// </summary>
        /// <param name="type"></param>
        public void ShowUIForms(UIPanelType type)
        {
            BasePanel basePanel = GetPanel(type);
            switch (basePanel.uiType.uiFormShowMode)
            {
                case UIFormShowMode.Normal:
                    EnterUIFormsCache(type);
                    break;
                //如果是反切换类型则入栈
                case UIFormShowMode.ReverseChange:
                    PushPanel(type);
                    break;
                //如果是隐藏其他的类型,清空显示的界面
                case UIFormShowMode.HideOther:
                    HideOtherPanel(type);
                    break;
            }
        }
    
        /// <summary>
        /// 隐藏界面 如果显示界面字典里面存在此界面
        /// </summary>
        /// <param name="type"></param>
        public void HideUIForms(UIPanelType type)
        {
            BasePanel basePanel = GetPanel(type);
    
            switch (basePanel.uiType.uiFormShowMode)
            {
                case UIFormShowMode.Normal:
                    HideUIFormsCache(type);
                    break;
                //如果是反切换类型则出栈
                case UIFormShowMode.ReverseChange:
                    PopPanel(type);
                    break;
                case UIFormShowMode.HideOther:
                    HideUIFormsCache(type);
                    break;
            }
        }
    
        /// <summary>
        /// 隐藏除此之外的Panel,如果不赋值则清空所有
        /// </summary>
        /// <param name="type"></param>
        public void HideOtherPanel(UIPanelType type = UIPanelType.Null)
        {
            foreach (KeyValuePair<UIPanelType,BasePanel> item in _DicShowPanel)
            {
                item.Value.OnExit();
            }
            _DicShowPanel.Clear();
            if (type != UIPanelType.Null)
            {
                BasePanel basePanel = GetPanel(type);
                basePanel.OnEnter();
                _DicShowPanel.Add(type, GetPanel(type));
            }
                
        }
    
        /// <summary>
        /// 将UI加入到已显示面板的字典中
        /// </summary>
        /// <param name="type"></param>
        private void EnterUIFormsCache(UIPanelType type)
        {
            //如果显示面板字典里面有当前面板则返回
            if (_DicShowPanel.ContainsKey(type)) return;
            BasePanel basePanel = GetPanel(type);
            _DicShowPanel.Add(type, basePanel);
            basePanel.OnEnter();
        }
    
        /// <summary>
        /// 将UI隐藏
        /// </summary>
        /// <param name="type"></param>
        private void HideUIFormsCache(UIPanelType type)
        {
            //如果显示面板字典里面没有当前面板则返回
            if (!_DicShowPanel.ContainsKey(type)) return;
            BasePanel basePanel = GetPanel(type);
            _DicShowPanel.Remove(type);
            basePanel.OnExit();
        }
    
        /// <summary>
        /// 根据面板类型得到实例化的面板
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        private BasePanel GetPanel(UIPanelType type)
        {
            if (_DicPanel.ContainsKey(type))
            {
                return _DicPanel[type];
            }
            else
            {
                //如果找不到就找这个面板的prefab的路径,然后根据prefab去实例化面板
                BasePanel panel;
                string panelPath = _DicPanelPath.GetValue(type);
                GameObject insGo = GameObject.Instantiate(Resources.Load(panelPath),Canvas) as GameObject;
                insGo.name = type.ToString();
                panel = insGo.GetComponent<BasePanel>();
                switch (panel.uiType.uIFormParentType)
                {
                    case UIFormParentType.FUllScreen:
                        insGo.transform.SetParent(_TraFullScreen);
                        break;
                    case UIFormParentType.Fixed:
                        insGo.transform.SetParent(_TraFixed);
                        break;
                    case UIFormParentType.PopUp:
                        insGo.transform.SetParent(_TraPopUp);
                        break;
                }
                _DicPanel.Add(type, panel);
                return panel;
            }
        }
    
        #region 解析地址json 并存储到字典中
        
        private void ParseUIPanelPathJson()
        {
            TextAsset text = Resources.Load<TextAsset>("UIPanelType");
            JSONObject jSONObject = new JSONObject(text.text);
            if (_DicPanelPath == null)
                _DicPanelPath = new Dictionary<UIPanelType, string>();
            foreach (JSONObject item in jSONObject.list)
            {
                string panelTypeString = item["panelTypeString"].str;
                string path = item["path"].str;
                UIPanelType uIPanelType = (UIPanelType)System.Enum.Parse(typeof(UIPanelType), panelTypeString);
                _DicPanelPath.Add(uIPanelType, path);
            }
        }
    
        #endregion
    
    }
    
    using System.Collections;
    using System;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.UI;
    
    
    public class BasePanel : MonoBehaviour {
    
    
        protected CanvasGroup cg;
        public UIType uiType;
    
    
        private void Awake()
        {
            InitData();
        }
    
    
        public virtual void OnCloseBtnClick()
        {
            UIManager.Instance.HideUIForms(uiType.uiPanelType);
        }
    
    
        public virtual void InitData()
        {
            if (cg == null)
                cg = this.gameObject.GetAndAddComponent<CanvasGroup>();
            if (uiType == null)
                uiType = new UIType();
        }
    
    
    
    
        /// <summary>
        /// 界面被显示出来
        /// </summary>
        public virtual void OnEnter()
        {
            cg.alpha = 1;
            cg.blocksRaycasts = true;
            this.gameObject.transform.SetAsLastSibling();
        }
    
    
        /// <summary>
        /// 界面暂停 指的是当其他界面在此界面之上,此界面不是主界面的时候,此界面不接受鼠标检测,如果不需要此功能可以适当更改
        /// </summary>
        public virtual void OnPause()
        {
            cg.blocksRaycasts = false;
        }
    
    
        /// <summary>
        /// 界面继续
        /// </summary>
        public virtual void OnResume()
        {
            cg.blocksRaycasts = true;
        }
    
    
        /// <summary>
        /// 界面不显示,退出这个界面
        /// </summary>
        public virtual void OnExit()
        {
            cg.alpha = 0;
            cg.blocksRaycasts = false;
        }
    	
    }
    

     

    using System.Collections;
    using System;
    using System.Collections.Generic;
    using UnityEngine;
    
    public class UIType  {
    
        /// <summary>
        /// panel类别
        /// </summary>
        public UIPanelType uiPanelType;
        /// <summary>
        /// Panel的显示方式,有正常显示,隐藏其他和反向切换
        /// </summary>
        public UIFormShowMode uiFormShowMode = UIFormShowMode.Normal;
        /// <summary>
        /// 这个透明度暂时没用
        /// </summary>
        public UIFormLucencyType uIFormLucencyType = UIFormLucencyType.Lucency;
        /// <summary>
        /// Panel的父物体类型
        /// </summary>
        public UIFormParentType uIFormParentType = UIFormParentType.PopUp;
    

     

    代码比较多,不过都有贴心的注释

     

    -------------------------------加了一个代码自动生成的工具-----------------------------------

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using System.Threading.Tasks;
    using System;
    using UnityEditor;
    using System.IO;
    using System.Text;
    using UnityEngine.UI;
    
    public class UIElement
    {
        public string Name;
        public string Path;
        public string ComponentName;
        public UIElement(string name,string path,string componentName)
        {
            Name = name;
            Path = path;
            ComponentName = componentName;
        }
    
        public override string ToString()
        {
            string str = string.Format("Name={0} || Path={1} || ComponentName={2}", Name, Path, ComponentName);
            return str;
        }
    }
    
    public class UICodeGenerator
    {
        [MenuItem ( "Assets/CreateCodeDeleteComponent" )]
        public static void CreateCodeDeleteComponent ()
        {
            GetPath ( true );
        }
        
        [MenuItem ( "Assets/OnlyCreateCode" )]
        public static void OnlyCreateCode ()
        {
            GetPath ( false );
        }
        
        public static void GetPath (bool isDeleteComponent)
        {
            var objs =
                Selection.GetFiltered ( typeof ( GameObject ), SelectionMode.Assets | SelectionMode.TopLevel );
            GameObject obj = objs[ 0 ] as GameObject;
            elements = new List<UIElement> ();
            GetPathAs ( obj.transform, isDeleteComponent );
    
            foreach ( var item in elements )
            {
                Debug.Log ( item );
            }
    
            GeneratePane ( "Assets/" + obj.name + ".cs", obj.name, elements );
            GenerateCtrl ( "Assets/" + obj.name + "Ctrl.cs", obj.name, elements );
    
        }
    
        public static List<UIElement> elements;
    
        static void GetPathAs ( Transform transform ,bool isDeleteComponent)
        {
            foreach ( Transform child in transform )
            {
                if ( child.gameObject.GetComponent<UIMark> () )
                {
                    elements.Add ( new UIElement ( child.name, GetPath ( child ),
                                                   child.gameObject.GetComponent<UIMark> ().ComponentName ) );
                    if ( isDeleteComponent )
                        GameObject.DestroyImmediate ( child.gameObject.GetComponent<UIMark> (), true );
                }
    
                if ( child.childCount != 0 )
                {
                    GetPathAs ( child, isDeleteComponent );
                }
            }
        }
    
    
        public static void GeneratePane ( string generateFilePath, string behaviourName, List<UIElement> elements )
        {
            var sw         = new StreamWriter ( generateFilePath, false, Encoding.UTF8 );
            var strBuilder = new StringBuilder ();
    
            strBuilder.AppendLine ( "using UnityEngine;" );
            strBuilder.AppendLine ( "using UnityEngine.UI;" );
            strBuilder.AppendLine ();
            strBuilder.AppendFormat ( "public class {0} : BasePanel ", behaviourName );
            strBuilder.AppendLine ();
            strBuilder.AppendLine ( "{" );
            foreach ( var item in elements )
            {
                strBuilder.AppendLine ( "\tpublic " + item.ComponentName + " " + item.Name + " { get; private set; }" );
            }
    
            strBuilder.AppendLine ();
            strBuilder.AppendLine ( "\tpublic override void InitData()" );
            strBuilder.AppendLine ( "\t{" );
            foreach ( var item in elements )
            {
                strBuilder.AppendFormat ( "\t\t{0} = transform.Find(\"{1}\").GetComponent<{2}>();", item.Name,
                                          item.Path.Replace ( behaviourName + "/", "" ), item.ComponentName );
                strBuilder.AppendLine ();
            }
    
            strBuilder.AppendLine ();
            strBuilder.AppendLine ( "\t\tuiType.uIFormParentType = UIFormParentType.PopUp;" );
            strBuilder.AppendLine ( "\t\tuiType.uiFormShowMode = UIFormShowMode.Normal;" );
            strBuilder.AppendLine ( "\t\tuiType.uiPanelType = UIPanelType.BoxPanel;" );
            strBuilder.AppendLine ( "\t}" );
            strBuilder.AppendLine ( "}" );
            sw.Write ( strBuilder );
            sw.Flush ();
            sw.Close ();
    
            AssetDatabase.SaveAssets ();
            AssetDatabase.Refresh ();
        }
    
        public static void GenerateCtrl ( string generateFilePath, string behaviourName , List<UIElement> elements)
        {
            var sw         = new StreamWriter ( generateFilePath, false, Encoding.UTF8 );
            var strBuilder = new StringBuilder ();
    
            List<UIElement> temp = new List<UIElement> ();
            
            foreach ( UIElement element in elements )
            {
                if(element.ComponentName.Equals("Button"))
                    temp.Add(element);
            }
            
            strBuilder.AppendLine ( "using UnityEngine;" );
            strBuilder.AppendLine ( "using UnityEngine.UI;" );
            strBuilder.AppendLine ();
            strBuilder.AppendFormat ( "public class {0}Ctrl : BaseCtrl ", behaviourName );
            strBuilder.AppendLine ( "{" );
            strBuilder.AppendLine ();
            strBuilder.AppendFormat ( "\tprivate {0} panel;", behaviourName );
            strBuilder.AppendLine ();
            strBuilder.AppendLine ();
            strBuilder.AppendLine ( "\tpublic override void InitPanel()" );
            strBuilder.AppendLine ( "\t{" );
            strBuilder.AppendFormat ( "\t\tpanel = GetComponent<{0}>();", behaviourName );
            strBuilder.AppendLine ();
            foreach ( UIElement element in temp )
            {
                strBuilder.AppendFormat ( "\t\tpanel.{0}.AddListenerGracefully( {1}Click );", element.Name, element.Name );
                strBuilder.AppendLine ();
            }
            strBuilder.AppendLine ( "\t}" );
            strBuilder.AppendLine ();
            foreach ( UIElement element in temp )
            {
                strBuilder.AppendFormat ("\tvoid {0}Click()",element.Name);
                strBuilder.AppendLine ();
                strBuilder.AppendLine ( "\t{" );
                strBuilder.AppendLine ();
                strBuilder.AppendLine ( "\t}" );
                strBuilder.AppendLine ();
            }
    
            strBuilder.AppendLine ( "}" );
            sw.Write ( strBuilder );
            sw.Flush ();
            sw.Close ();
    
            AssetDatabase.SaveAssets ();
            AssetDatabase.Refresh ();
        }
    
        public static string GetPath ( Transform transform )
        {
            var sb = new System.Text.StringBuilder ();
            var t  = transform;
            while ( true )
            {
                sb.Insert ( 0, t.name );
                t = t.parent;
                if ( t )
                {
                    sb.Insert ( 0, "/" );
                }
                else
                {
                    return sb.ToString ();
                }
            }
        }
    }
    

     

     

    using UnityEngine.UI;
    using UnityEngine;
    
    /// <inheritdoc />
    /// <summary>
    /// UI的标记
    /// </summary>
    public class UIMark : MonoBehaviour
    {
        //public UIMarkType MarkType = UIMarkType.DefaultUnityElement;
    
        public Transform Transform
        {
            get { return transform; }
        }
    
        public string CustomComponentName = "";
        
        public virtual string ComponentName
        {
            get
            {
                if ( !string.IsNullOrEmpty ( CustomComponentName ) )
                    return CustomComponentName;
                if (null != GetComponent("SkeletonAnimation"))
                    return "SkeletonAnimation";
                if (null != GetComponent<ScrollRect>())
                    return "ScrollRect";
                if (null != GetComponent<InputField>())
                    return "InputField";
                if (null != GetComponent<Text>())
                    return "Text";
                if (null != GetComponent("TMP.TextMeshProUGUI"))
                    return "TextMeshProUGUI";
                if (null != GetComponent<Button>())
                    return "Button";
                if (null != GetComponent<RawImage>())
                    return "RawImage";
                if (null != GetComponent<Toggle>())
                    return "Toggle";
                if (null != GetComponent<Slider>())
                    return "Slider";
                if (null != GetComponent<Scrollbar>())
                    return "Scrollbar";
                if (null != GetComponent<Image>())
                    return "Image";
                if (null != GetComponent<ToggleGroup>())
                    return "ToggleGroup";
                if (null != GetComponent<Animator>())
                    return "Animator";
                if (null != GetComponent<Canvas>())
                    return "Canvas";
                if (null != GetComponent("Empty4Raycast"))
                    return "Empty4Raycast";
                if (null != GetComponent<RectTransform>())
                    return "RectTransform";
    
                return "Transform";
    
    
            }
        }
    }
    

    使用方法,把需要使用的组件加上UIMark标记,拖成预设体,右键点击自动生成代码,就会自动生成视图和控制层

    -------------------------------弃用-------------------------------------

    思想可以借鉴,但是使用起来不是很方便

    最新版框架借鉴QFramework,喜欢的可以去看看

    展开全文
  • using System; using System.Collections.Generic; using System.Reflection; using UnityEngine; using UnityEngine.EventSystems;...using UnityEngine.UI; public class ComponentFindTool { private Dictiona...
  • Unity3D快速实现UI架构设计一

    千次阅读 2017-05-14 20:15:57
    笔者介绍:姜雪伟,IT公司技术合伙人,IT高级讲师,CSDN社区专家,特邀...CSDN视频网址:http://edu.csdn.net/lecturer/144 在利用Unity3D引擎开发程序时,UI资源的加载,卸载,隐藏以及UI渐变动画等功能是UI架构设计
  • Unity3d UI设计简述

    千次阅读 2017-05-07 01:27:22
    在我们的实训项目,本人主要负责UI的设计以及unity中UI界面的代码编写部分。 由于之前没有对Unity进行过深入的了解,于是在实训开始的初期,我首先对于unity中UI界面部分的功能进行了了解。 Canvas Canvas是...
  • unity3d UI性能优化。

    千次阅读 2018-04-28 18:00:13
    UI(UGUI)上面的优化,我想从三个方向来分析:drawcall的优化动静分离的优化文本,图片预选项的优化三个优化,性能占比,从高到底。一. drawcall的优化 drawcall可以通过点开Stats和Window-&gt;Frame ...
  • unity3d中添加场景UI

    2019-09-18 11:14:48
    修改canvas的renderMode改成worldSpace,去掉其他组件,修改位置,缩放值改为0.01(可根据项目需求自行修改)从图可以看出:player是一个单独的draw call,canvas整体是一个draw call,里面text和图片button分别...
  • Unity3d 5 官方教程:UI

    万次阅读 2017-03-29 23:30:12
    本篇是对UnityUI系统主要特性的介绍。 相关教程:用户界面CanvasCanvas是所有UI元素应当存放于内的区域。Canvas是一个有Canvas组件的游戏对象,并且所有UI对象必须是这样一个Canvas对象的子对象。
  • Unity3d中UI开发的MVC模式 - 道心惟纯 - CSDN博客
  • 本课程主要介绍Unity3dUI系统(UGUI),先对UGUI做一个总体概述,之后对每个UI控件逐一进行详细讲述,内容包括控件的作用、设置方法、使用场景及属性细节,帮助大家熟练使用UGUI设计游戏的交互界面。...
  • Unity 的 Rich Text Unity中的富文本格式,通过类似html的标签语言来实现,支持常见的加粗,倾斜,颜色等,可以应用于GUI、UGUI和Debug日志输出。 Rich Text 的使用 原文: We are definitely not amused ...
  • unity 3dui层在scence界面看不见

    千次阅读 2019-06-03 13:01:34
    2.可是1这种方法显然不是我想要的 , 后来发现,你要把这个· layer的 UI层的小眼睛给打开,你可以在scence面板看到了 拓展 :tip1.雾在scence没显示,将下面的fog给选中 tip2 :在game也没有雾 ,需要...
  • Unity 3D:实时更新画布上的UI元素 (Unity 3D: Update UI Elements on Canvas in Realtime) In the last tutorial we learned how we can add a Text label UI Element to our Game canvas. 在上一教程,我们...
  • Unity3D UI EventTrigger 动态绑定UI事件

    千次阅读 2019-05-30 10:40:07
    Unity3D UI 动态绑定UI事件
  • [Unity3d]谈谈UI分辨率适配

    千次阅读 2014-11-14 21:38:17
    [Unity3d]谈谈UI分辨率适配  (2013-12-29 22:00:31) 转载▼ 标签:  ui适配   ui分辨率   ui比例   ui兼容   it 分类: Unity3d 多种分辨率的UI适配一直...
  • unity3D UI界面计时器

    千次阅读 2019-03-18 14:14:03
    计时器不难写,但是麻烦。运行界面自然不用说,后台也要计时的话就需要用到保存了,接下来就直接上代码了,里面有些无用的东西还请无视!...using UnityEngine.UI; using System; /// &lt;summa...
  • Unity中UI跟随3D物体 即HUD效果

    千次阅读 2018-08-06 10:19:38
    今天简单的测试了Unity中UI跟随3D物体,使用Unity版本:5.6.4。 首先想到的有两种思路: 1、第一种方法基于RectTransformUtility.ScreenPointToWorldPointInRectangle和 Camera.main.WorldToScreenPoint这两个方法...
  • 比如血条等的位置,实时跟随主角。 using UnityEngine; public class Game3DPosToUIPosMyTest : MonoBehaviour ... public Transform targetTran;... public RectTransform ... public Camera uiCamera; public ...
1 2 3 4 5 ... 20
收藏数 5,066
精华内容 2,026
关键字:

text unity3d中ui