简体   繁体   English

在 unity2d 中尝试在屏幕上添加游戏时不断出现错误

[英]keep getting an error when trying to add a game over screen in unity2d

i'm trying to make a 2d platformer in unity and am trying to make it so that when the player falls off the cliff it shows the game over screen, however I keep getting the error code:我正在尝试统一制作一个 2d 平台游戏,并且正在努力做到这一点,以便当玩家从悬崖上掉下来时,它会在屏幕上显示游戏,但是我不断收到错误代码:

"Assets\Script\ShowDeath.cs(13,22): error CS1061: 'Transform' does not contain a definition for 'postion' and no accessible extension method 'postion' accepting a first argument of type 'Transform' could be found (are you missing a using directive or an assembly reference?)" “Assets\Script\ShowDeath.cs(13,22):错误 CS1061:‘Transform’不包含‘postion’的定义,并且找不到接受‘Transform’类型的第一个参数的可访问扩展方法‘postion’(您是否缺少 using 指令或程序集引用?)”

heres the code这是代码

float deathArea = -4f;
public GameObject deathUI;

void Update()
{
      if(transform.postion.y <= deathArea)
      {
            deathUI.SetActive(true);
      }
}

pretty simple code, I just can't figure out what the error means非常简单的代码,我只是无法弄清楚错误的含义

turns out I spelt "position" wrong and wrote "postion" so unity didn't know what I was trying to say结果我把“position”拼错了,写的是“position”,所以 unity 不知道我想说什么

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM