Question by
AshVoice · Jun 16, 2019 at 06:41 AM ·
enemiesgame window
How make my enemies be visiable in a game window ?
Hello everyone, I'm a beginner and I have a problem. I can't see my enemies in the game window. I will be grateful if somebody could help me.
Here is a screen
Here is a script
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class Spawner : MonoBehaviour
{
public Transform[] spawnPoints;
public GameObject[] hazards;
private float timeBtwSpawns;
public float startTimeBtwSpawns;
// Update is called once per frame
void Update()
{
if(timeBtwSpawns<=0)
{
Transform randomSpawnPoint = spawnPoints[Random.Range(0, spawnPoints.Length)];
GameObject randomHazard = hazards[Random.Range(0, hazards.Length)];
Instantiate(randomHazard, randomSpawnPoint.position, Quaternion.identity);
timeBtwSpawns = startTimeBtwSpawns;
} else
{
timeBtwSpawns -= Time.deltaTime;
}
}
}
new-bitmap-image.png
(40.6 kB)
Comment
Can you provide a screenshot showing the inspector of one of your enemies?
Aren't they behind the camera? Did you check their layer?
Your answer
Follow this Question
Related Questions
Make a gameobject spawn before enemies spawn? (C#) 1 Answer
A simple question about the TrailRenderer component. 0 Answers
Multiple AI enemies: Using OnTrigger for "line of sight" activates all enemies at once 2 Answers
How to Reuse Script on Enemies - Please Help! 2 Answers
Killed enemies counter 4 Answers