在2D游戏中,我使用下面的脚本来夹紧UI图像给玩家,但是当玩家移动时,图像有点抖动。我做错了什么?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class HealthBarClamp : MonoBehaviour
{
public Transform targetToFollow;
Transform thisTransform;
void Start()
{
thisTransform = transf
我目前正在尝试为我的游戏编写一个健康系统,我希望我的玩家GameObject忽略与健康药水GameObject的冲突,如果玩家有最大的健康。我的问题是,我不能简单地关闭玩家层和健康药水层之间的碰撞,因为我只想忽略碰撞,如果玩家有最大健康。我试着自己做,但没有效果。下面是我的代码: public class ExampleCodeUA : MonoBehaviour{
public int PlayerMaxHealth = 100, PlayerCurrentHealth;
public HealthBar healthBar;
private void Start()
{
Pl
在我的游戏中,我有一个健康的玩家,我目前正在尝试添加一个健康栏,但我的一个问题是,当我的玩家失去马力时,我的健康栏不会改变。在我的脚本中,更新heathbar的脚本与我的健康脚本链接在一起,但是当我的玩家失去hp时,玩家的hp不会在健康栏中改变,我不知道为什么。我知道玩家确实失去了hp,所以问题是,即使脚本是链接的,hp在单独的脚本上也不会改变。我健康栏的剧本:
抱歉,如果代码不好,我是个新手程序员。
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Heal