I have a prefab I’m trying to instantiate when I enter a trigger in a 2D game. I get the following errors:
Assets/Meep/Dialogues/hoardstart.cs(15,37): error CS0103: The name ‘hoard’ does not exist in the current context.
Assets/Meep/Dialogues/hoardstart.cs(15,44): error CS0119: Expression denotes a type', where a
variable’, value' or
method group’ was expected.
Assets/Meep/Dialogues/hoardstart.cs(15,25): error CS1502: The best overloaded method match for ‘UnityEngine.Object.Instantiate(UnityEngine.Object, UnityEngine.Vector3, UnityEngine.Quaternion)’ has some invalid arguments
Assets/Meep/Dialogues/hoardstart.cs(15,25): error CS1503: Argument #1' cannot convert
object’ expression to type `UnityEngine.Object’
Here is my script:
using UnityEngine;
using System.Collections;
public class hoardstart : MonoBehaviour {
//private bool bShowGUI = false;
void Awake(){
// You must initialize Dialoguer before using it!
Dialoguer.Initialize();
}
void OnTriggerEnter2D (Collider2D other){
if (other.tag == "Player") {
Dialoguer.StartDialogue (11);
Destroy(this.gameObject);
Instantiate(hoard, Vector2 (x, y, 0), Quaternion.identity);
}
}
}