I want to instantiate a prefab. I have placed an EmptyObject in my scene. It is named HorseSpawn. I have attached a C# script to it named HorseSpawn. I have a “Horse” prefab in my Resources.
using UnityEngine;
using System.Collections;
public class HorseSpawn : MonoBehaviour {
// Use this for initialization
void Start () {
Instantiate(Resources.Load ("Horse") as GameObject);
}
// Update is called once per frame
void Update () {
}
}
I had assumed that it would inherit the position of the Empty to which the script was attached. It did not. So, what can I do to make it spawn at my EmptyObject?
I am very new to Unity (obviously) and just trying to get my head around the basics. Could you please point me in the right direction? The Unity docs are too complicated to understand. I think they assume we’re all fluent in programming