【Uinty3D】2D飞机的基础——攻击

2D生成物体

定义要生成的物体

public GameObject ball ;

定义生成物体的位置

public Transforn balltPos;

在Start函数中

  获取物体生成的位置

  ballPos = transform.Find ("ballPosition");

在Updata函数中

  当按下鼠标左键

  if(Input.GetMousButtonDown(0))

  生成物体

  Instantiate(ball,ballPos.position,ballPos.rotation);

posted @ 2018-12-11 15:10  Whiteying  阅读(191)  评论(0编辑  收藏  举报