Thursday, February 14, 2019

Unity 3d make check point system c# sharp script by allunityscripts

Check Point 



using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Checkpoint : MonoBehaviour {
    public Transform checkpoint;
    GameObject player;
// Use this for initialization
void Start () {

        player = GameObject.FindWithTag("Player");
}

// Update is called once per frame
void OnTriggerEnter (Collider plyr) {
if(plyr.gameObject.tag == "Player")
        {
            player.transform.position = checkpoint.position;
            player.transform.rotation = checkpoint.rotation;
        }
}
}

1 comment: