Unity - A计划(一年有效期) 扫二维码继续学习 二维码时效为半小时

(61评价)
价格: 2190.00元
关于Getcomponent
克莱宝宝发起了问答2019-03-21
1
回复
301
浏览
void CreateBullet(){      
  float b1 = (bullet.GetComponent<BulletFather>().CurrSpeed / bullet.GetComponent<BulletFather>().Speed) - 1;
        float b2 = ((float)bullet.GetComponent<BulletFather>().CurrAtt / bullet.GetComponent<BulletFather>().Att) - 1;
}
void CreateBullet(){
BulletFather BulFather = bullet.GetComponent<BulletFather>(); 
float b1 = (BulFather.CurrSpeed / BulFather.Speed) - 1;
        float b2 = (BulFather.CurrAtt /BulFather.Att) - 1;
}

第二个代码是不是更加节约性能

所有回复
发表回复
你还没有登录,请先 登录或 注册!