Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class instancier_new_object : MonoBehaviour {
  6.  
  7. public float moveSpeed=5f;
  8.  
  9. void Update () {
  10. if (Input.GetKeyDown (KeyCode.Q)) {
  11. GameObject objet = new GameObject ("objet");
  12. GameObject cube = new GameObject ("cube");
  13.  
  14. cube = Instantiate(
  15. objet,
  16. new Vector3(1, 2, 3),
  17. Quaternion.identity
  18. );
  19. }
  20.  
  21. cube.transform.Translate(
  22. Time.deltaTime*moveSpeed,
  23. 0,
  24. -Time.deltaTime*moveSpeed,
  25. Space.Self
  26. );
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement