Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class CreaPelotas : MonoBehaviour {
- public GameObject pelota;
- // Use this for initialization
- void Start () {
- }
- // Update is called once per frame
- void Update () {
- if (GameObject.Find ("PelotaNueva") == null) {
- if (Input.GetKeyDown (KeyCode.Space)) {
- GameObject pelotaNueva = (GameObject)Instantiate (pelota);
- pelotaNueva.name = "PelotaNueva";
- pelotaNueva.transform.position = new Vector3 (pelota.transform.position.x, pelota.transform.position.y + 5, pelota.transform.position.z);
- }
- }
- if (Input.GetKeyDown(KeyCode.B)){
- if(GameObject.Find("PelotaNueva") != null){
- Destroy(GameObject.Find ("PelotaNueva"));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement