I have this script:
public class PikeableObjectRellat : MonoBehaviour
{
public bool Pikeado = true;
public GameObject AgarrarRuna;
void Start()
{
AgarrarRuna = GameObject.Find("TextAgarrarRuna");
AgarrarRuna.SetActive(false);
}
void OnTriggerEnter(Collider other)
{
if (other.tag == "VMExtra")
{
other.GetComponentInParent<RunaRellat>().ObjectoAPikear = this.gameObject;
AgarrarRuna.SetActive(true);
}
}
private void OnTriggerExit(Collider other)
{
if (other.tag == "VMExtra")
{
other.GetComponentInParent<RunaRellat>().ObjectoAPikear = null;
AgarrarRuna.SetActive(false);
}
}
}
and this:
public class MisionesGuardadas : MonoBehaviour
public GameObject SpawnRuna;
public GameObject RunaKalharumSpawner;
public void Awake()
{
Instantiate(RunaKalharumSpawner, SpawnRuna.transform.position, SpawnRuna.transform.rotation);
}
but when the object (clone) is instantiated, it does not find the object assigned in the original prefab, how do I do it?.
The original prefab contains the script “PikeableObjectRellat”
Error Clone: “NullReferenceException: Object reference not set to an instance of an object
PikeableObjectRellat.Start () (at Assets/Runas/Rellat/PikeableObjectRellat.cs:19)”