Search Unity

Instantiated clones are spawning much bigger than original

Discussion in 'Scripting' started by AthleticSeafood, Aug 30, 2019.

  1. AthleticSeafood

    AthleticSeafood

    Joined:
    Aug 25, 2018
    Posts:
    6
    So long story short, my spawn manager is somehow creating clones that are much bigger than the original object and do not function at all. It's as if they're being instantiated without the script? I have no idea what's going on or how to fix it.

    Here's the code for the spawn manager:
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class SpawnManager : MonoBehaviour
    6. {
    7.     [SerializeField]
    8.     private GameObject enemyPrefab;
    9.  
    10.     [SerializeField]
    11.     private GameObject[] powerups;
    12.  
    13.     void Start()
    14.     {
    15.         StartCoroutine(EnemySpawnRoutine());
    16.     }
    17.     IEnumerator EnemySpawnRoutine()
    18.     {
    19.         while (true)
    20.         {
    21.             Instantiate(enemyPrefab, new Vector3(Random.Range(-7f, 7f), 7, 0), Quaternion.identity);
    22.             yield return new WaitForSeconds(5.0f);
    23.         }
    24.     }
    25. }
    26.  
    Here is a demonstration
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,745
    Looking at your log you are missing some scripts, such as "Enemy" and another unknown one. Did you look into if any of those scripts are responsible for scaling? If they're really not being used, just remove their references from the prefabs to reduce your warning chuff.