Answers for "how to make a door open in unity"

C#
0

how to make a door open in unity

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

public class DoorTrigger : MonoBehaviour
{

[SerializeField]
GameObject door;

bool isOpened = false;
void OnTriggerEnter(Collider col)
{

if (!isOpened)
{
    isOpened = true;
    door.transform.position += new Vector3 (0, 4, 0);
    }
}
}
Posted by: Guest on January-11-2021

Code answers related to "how to make a door open in unity"

C# Answers by Framework

Browse Popular Code Answers by Language