Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2018
164
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 teleport : MonoBehaviour {
  6.  
  7. // Use this for initialization
  8. void Start () {
  9. /* Confirm that the script is loaded */
  10. Console.write("Loaded teleport Script");
  11. }
  12.  
  13. // Update is called once per frame
  14. void Update () {
  15. Console.write("Frame Sent");
  16. }
  17. //Destination position
  18. public GameObject Destination;
  19.  
  20. // When trigger is triggered
  21. void OnTriggerEnter(Collider other) {
  22. Console.write("Collition detected");
  23. // If the trigger detects the player
  24. if (other.gameObject.tag == "Player")
  25. // Move Player to Destination position
  26. other.transform.position = Destination.transform.position;
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement