我在unity2020中从资源商店导入了
starter assets这一角色控制器
然后我在玩家控制的人物挂上了这一段脚本
(有些省略掉了,因为自己记不住那些单词)
//此处已省略
public gameObject move01;
void died(){
if(move01.activeInhierarchy==false){
move01.setactive(true);
}
}
void die(){
transform.position=new vector3(-4,0,0);
}
那个平面我设置为凸面是触发器,挂上了这一段
//此处已省略
public gameobject player;
private void ontriggerenter(此处已省略){
player.sendmessage("die");
player.sendmessage("died");
}
有时候move01(UI)能正常显示出来
有时候player不能移动至(-4,0,0)
本人学艺不精,之前只学过一段时间的python,看到Unity中的c#基础语法有点类似,没怎么系统的学习过c#