Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class instancier_new_object : MonoBehaviour {
- public float moveSpeed=5f;
- void Update () {
- if (Input.GetKeyDown (KeyCode.Q)) {
- GameObject objet = new GameObject ("objet");
- GameObject cube = new GameObject ("cube");
- cube = Instantiate(
- objet,
- new Vector3(1, 2, 3),
- Quaternion.identity
- );
- }
- cube.transform.Translate(
- Time.deltaTime*moveSpeed,
- 0,
- -Time.deltaTime*moveSpeed,
- Space.Self
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement