Advertisement
Guest User

Untitled

a guest
May 24th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class BulletSpawn : MonoBehaviour {
  6. public Transform bullet;
  7. public float bulletspeed;
  8. // Use this for initialization
  9. void Start () {
  10.  
  11. }
  12.  
  13. // Update is called once per frame
  14. void Update () {
  15. if (Input.GetMouseButtonDown (0)) {
  16. Transform BulletInst = (Transform)Instantiate (bullet, GameObject.Find ("Spawn").transform.position, Quaternion.identity);
  17. BulletInst.GetComponent<Rigidbody> ().AddForce (transform.forward * bulletspeed);
  18. }
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement