Unity UGUI(二)Image(图像)

Image(Script)

2019

  

2017

Source Image源图片当前展示的图片,格式为Sprite(2D and UI)的图片资源
Color颜色图片叠加的颜色
Material材质图片叠加的材质
Raycast Target光线投射目标是否作为射线投射目标,关闭之后忽略UGUI的射线检测。
Image Type图片显示类型
  • Simple:简单
    • Use Sprite Mesh:使用精灵网格
    • Preserve Aspect:保持长宽比
  • Sliced:已切片
    • Fill Center:填充中心
  • Tiled:已平铺
  • Filled:已填充
    • Fill Method:填充方法
      • Horizontal:水平
      • Vertical:垂直
      • Radial 90:放射状90度
      • Radial 180:放射状180度
      • Radial 360:放射状360度
    • Fill Origin:填充原点
      • Left:左
      • Right:右
      • Bottom:底
      • Top:顶
      • ……
    • Fill Amount:填充量
    • Clockwise:顺时针
    • Preserve Aspect:保持长宽比

Preserve Aspect: 是否保存图片宽高比

Set Native Size:设为图片原大小

动态换图

 --->  

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class TestUI : MonoBehaviour
{
    void Start ()
    {
        gameObject.GetComponent<Image>().sprite = Resources.Load<Sprite>("Sign");
    }

    void Update ()
    {
		
    }
}

 

  • 3
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值