- Home /
spawned clones are visible in scene tab but not visible in game tab
below code is used for spawning enemy character. problem is that the enemy which are spawning are not visible in game view , i can see them in scene view moving but in game view they are invisible , i have tried changing layer of characters , and also tried to align camera view but nothing is working
void Start()
{
StartCoroutine(SpawnMonsters());
}
IEnumerator SpawnMonsters()
{
while (true)
{
yield return new WaitForSeconds(Random.Range(1, 5));
randomIndex = Random.Range(0, monsterReference.Length);
randomSide = Random.Range(0, 2);
spawnedmonster = Instantiate(monsterReference[randomIndex]);
if (randomSide == 0)
{
spawnedmonster.transform.position = leftPos.position;
spawnedmonster.GetComponent<monster>().speed = Random.Range(4, 10);
}
else
{
spawnedmonster.transform.position = rightPos.position;
spawnedmonster.GetComponent<monster>().speed = -Random.Range(4, 10);
spawnedmonster.transform.localScale = new Vector3(-1f, 1f, 1f);
}
}
}
Could you make and share a $$anonymous$$imal (bare bones) Unity Project so we can take a look? Only include the bare necessities to reproduce the issue that you are having (like 1 character, 1 camera, nothing else etc).
Answer by subhnegi · Dec 15, 2021 at 01:49 PM
as you can see in hierarchy tab clones are being spwaned and we can see them in scene view but not in game view
does your culling mask on your camera has the layers checked?
Your answer
Follow this Question
Related Questions
Terrain Grass does not show 4 Answers
How to fix a game objects that changes its position when viewed in game mode? 1 Answer
Play Mode camera is not resetting to set transform. 0 Answers
instantiated two characters, but they only appear in scene mode. 0 Answers
Particle Emitter Layer Issue 0 Answers