Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma strict
- //object1 is a placeholder where the weapons are instatiated
- var object1 : GameObject;
- //object2 is a object(weapon)
- var object2 : GameObject;
- //object3 is the second object
- var object3 : GameObject;
- function Update () {
- //left MouseButton
- if (Input.GetMouseButtonDown (0)) {
- Instantiate(object2,object1.transform.position,object1.transform.rotation);
- Destroy (object3);
- }
- //Right Mousebutton
- if (Input.GetMouseButtonDown (1)) {
- Instantiate(object3,object1.transform.position,object1.transform.rotation);
- Destroy (object2);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement