前言
这里不一一罗列属性了,而是用到什么学什么
另外:使用UGUI的对象组件就要引用命名空间
using UnityEngine.UI;//UGUI命名空间
这里创建一个脚本,拖到CanvasUI对象上使用
Sprite图片制作
因为UGUI没有图集,所以ImageUI的图需要自己做UI图片Sprite,才能拖进Source Image里(包括Raw Image的)。
在网上下一个图片拖入工程,点击图片,查看检视面板
选则Sprite后要点击Apply一下
脚本代码
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;//UGUI命名空间
public class UGUITest : MonoBehaviour {
private Text _text;
private Image _image;
private RawImage _rawImage;
private Button _button;
private Toggle _toggle;