Hi, I’m just trying to make a portal graphic instantiate behind a door a few seconds after the door is triggered to open by the player.
I’ve got the Vector 3 coordinates and the rotation at which I want the prefab to appear in the scene.
The end of the code is a mess, but it sort of shows what I’m trying to do. I’ve been trying to find tutorials on YouTube to work out the correct way to write it.
Any feedback would be great.
using UnityEngine;
using System.Collections;
public class DoorScript1 : MonoBehaviour
{
GameObject MockronDoor1;
public GameObject portal;
void Start ()
{
MockronDoor1 = GameObject.Find ( "MockronDoor1" );
}
public void OnTriggerEnter ( Collider other )
{
if ( other.tag == "Player" )
{
MockronDoor1.animation.Play( "Door1OPEN" );
yield WaitForSeconds ('3');
Instantiate(portal, transform.Translate(Vector3(-47,38, -139)), transform.Rotate (Quaternion(-11,138,91));
}
}
}