So I have one script, as shown here:
using UnityEngine;
using System.Collections;
public class Objectives : MonoBehaviour
{
public Transform[] spawnlocation;
public GameObject[] SpawnPrefabObjective2;
public GameObject[] SpawnCloneObjective2;
void OnCollisionEnter (Collision col)
{
if (col.gameObject.name == "objective") {
Destroy (col.gameObject);
//THIS IS WHERE I WANT TO SCRIPT TO BE RUN FROM
}
if (col.gameObject.name == "objective2") {
Destroy (col.gameObject);
}
}
}
And I want to run this script:
using UnityEngine;
using System.Collections;
public class spawner : MonoBehaviour {
public Transform[] spawnlocation;
public GameObject[] SpawnPrefabObjective2;
public GameObject[] SpawnCloneObjective2;
void SpawnObjective(){
SpawnCloneObjective2 [0] = Instantiate (SpawnPrefabObjective2[0], spawnlocation[0].transform.position, Quaternion.Euler(0,0,0)) as GameObject;
}
}
I want to run the script after the first objective gameobject is destroyed, as shown in the first few lines of my first script. I don’t know how to run the 2nd script from the first, and I need help. Any help is appreciated, pls and thanks…
Yes I know I’m bad at this stuff…