I have a script where i click and spawn objects out of the bushes. the problem is when the Item is spawned which is shown in the heirarchy as (Clone) doesn't show in play mode can't see it anywhere.
this is the picture of the play mode:
and this is the script for the spawning objects i don't know if i'm doing something wrong in randomizing the position:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RandomObjectSpawner : MonoBehaviour
{
public GameObject[] myObjects;
void Update()
{
if (Input.GetMouseButtonDown(0))
{
int randomIndex = Random.Range(0, myObjects.Length - 1);
Vector3 randomSpawnPosition = new Vector3(Random.Range(-10, 11), 5, Random.Range(-10, 11));
Instantiate(myObjects[randomIndex], randomSpawnPosition, Quaternion.identity);
}
}
}
