设置HP条UI

概述

设置常见的生命值条,

实现过程

设置UI/image作为形状

设置UI/Image作为背景

设置UI/image(healthfill)作为填充图片,层数低于背景

设置heathfill的imagetype为filled

fillmethod为horizontal

csharp 复制代码
 [SerializeField] private Image healthFill;
 public void AddHealth(int healAmount)
    {
        health += healAmount;
        if (health > maxHealth)
            health = maxHealth;
        healthFill.fillAmount = health / maxHealth;
    }
相关推荐
辣香牛肉面1 天前
Photoshop CC 2025新手入门教程
ui·photoshop
tang&2 天前
【测试】Web页面UI自动化测试完全指南:8步通用测试框架
ui·测试
星栈独行2 天前
Makepad、egui、Dioxus、Tauri:Rust GUI 到底怎么选
开发语言·后端·程序人生·ui·rust
skywalk81632 天前
nginx的配置软件Nginx UI
运维·nginx·ui
め.2 天前
UIFramework
ui·unity
互联网散修2 天前
鸿蒙实战:图片编辑器——添加文字的UI适配与键盘避让
ui·编辑器·harmonyos
YJlio2 天前
OpenClaw v2026.5.26-beta.1 / beta.2 预发布解读:Gateway 加速、transcript 路径统一、多通道修复、语音增强与安装更新链路加固
人工智能·windows·python·ui·缓存·gateway·outlook
Roc-xb2 天前
hermes-web-ui安装教程
前端·ui·hermes-web-ui
xiami_world3 天前
从prompt到产品:AI 生成 UI 的三条技术路径对比与工程实践
人工智能·ui·ai·prompt·aigc·ai编程
ZC跨境爬虫3 天前
跟着 MDN 学CSS day_50:(传统布局方法与网格系统)
前端·css·ui·tensorflow·媒体