Reply To: Instantiating Prefab Problems

Forum Archive Instantiating Prefab Problems Reply To: Instantiating Prefab Problems

#34514

I tried what you said but I am still running into the same issue. I added a transform variable called haveBabyHere. Then I drug the empty game object that is parented to the front of the baby into that variable in the inspector panel. Here is the script and some screen shots for more context. 

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

public class BayBay : MonoBehaviour {

public GameObject Baby;
GameObject BabyClone;
private int timeForBaby;
public Transform haveBabyHere;


void Update()
{
Debug.Log(haveBabyHere);
if (script.yesbaby > 1)
{
Debug.Log("heres the baby");
BabyClone = Instantiate(Baby, haveBabyHere.position, haveBabyHere.rotation) as GameObject;
script.yesbaby = 1;
}
}

}

Sorry the picture is so grainy, I can not find a way to make it look nice since it has to fit in the margins.