Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class InstanciarCubo : MonoBehaviour
- {
- public Button botao;
- public GameObject cubo;
- public Transform cameraJogo;
- // Use this for initialization
- void Start()
- {
- Button btn = botao.GetComponent<Button>();
- btn.onClick.AddListener(instanciarBloco);
- }
- // Update is called once per framed
- void Update()
- {
- }
- void instanciarBloco()
- {
- GameObject novoCubo = GameObject.Instantiate(cubo, cameraJogo.transform.position + cameraJogo.transform.forward*3, Quaternion.identity);
- novoCubo.AddComponent<MoverAlgo>();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement