Hi all,
This code was working in my game prior to upgrading to Unity 5.3. Now, not so much. I’m spawing a block that should collide with another block (all have 2D colliders that are not triggers) but they simply pass through each other on the same layer. Any help would be appreciated!
using UnityEngine;
using System.Collections;
public class SpawnerScript : MonoBehaviour {
public float spawnTime = 5f; // The amount of time between each spawn.
public float spawnDelay = 3f; // The amount of time before spawning starts.
public GameObject [] enemy; // enemy prefab.
void Start ()
{
// Start calling the Spawn function repeatedly after a delay .
InvokeRepeating("Spawn", spawnDelay, spawnTime);
}
void Spawn ()
{
// Instantiate a random enemy.
int enemyIndex = Random.Range(0, enemy.Length);
Instantiate(enemy[enemyIndex], transform.position, transform.rotation);
}
}