关于Unity变量运行修改后如何保存?
答案:2 悬赏:40
解决时间 2021-02-19 07:24
- 提问者网友:房东的猫
- 2021-02-19 00:04
关于Unity变量运行修改后如何保存?
最佳答案
- 二级知识专家网友:摧毁过往
- 2021-02-19 01:01
这个可以用playerpref记录
全部回答
- 1楼网友:眠于流年
- 2021-02-19 01:24
var hp : playerhp;
function start () {
hp = gameobject.find("player-hp").getcomponent(playerhp);
}
function update () {
}
function onparticlecollision (other : gameobject) {
if (other.gameobject.tag == "wall-attack")
{
hp.health = hp.health - 5;
//此脚本侦测到粒子碰撞时playerhp里的health变量减5~~
print(hp.health);
//显示playerhp里的health变量~~
}
}
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯