2D C#
I am creating a Vampire Survivors like game. So I have an enemy spawner that spawns enemies at random locations around the player. It is working great for that part. The next step for the spawner is to make it spawn “boss” enemies. The only thing I want to change visually for the bosses is their size.
I thought this would be as easy creating a new prefab with the same sprite and scaling it up but, the enemies still come out at the normal scale. The spawner is not a child of any other object and I’ve tried increasing the scale of the spawner thinking that might be what is controlling the scale of the enemy with no luck. The code is currently set up to spawn the BossObject every time for testing puposes.
I am hoping someone could provide some insight as to why a prefab thats scaled to 3,3,3 is coming out as 1,1,1 when instantiated through code.
Thanks!
Spawner code
public class EnemySpawner : MonoBehaviour
{
[SerializeField]
private GameObject enemy;
[SerializeField]
private GameObject BossObject;
private GameObject newEnemy;
private GameObject BossEnemy;
private SpriteRenderer rend;
private int randomSpawnZone;
private float randomXposition, randomYposition;
private Vector3 spawnPostion;
public GameObject playerToFollow;
public float SpawnDelay;
public float SpawnRate;
public float MinRange = 0f;
public float MaxRange = 10f;
public float BossSpawnRate = 5f;
// Start is called before the first frame update
void Start()
{
playerToFollow = GameObject.FindGameObjectWithTag("Player");
InvokeRepeating("SpawnNewEnemy", SpawnDelay, SpawnRate);
}
// Update is called once per frame
void Update()
{
transform.position = playerToFollow.transform.position;
}
private void SpawnNewEnemy()
{
randomSpawnZone = Random.Range(0, 4);
switch (randomSpawnZone)
{
case 0:
randomXposition = Random.Range(transform.position.x + -11f, transform.position.x + -10f);
randomYposition = Random.Range(transform.position.y + -8f, transform.position.y + -8f);
break;
case 1:
randomXposition = Random.Range(transform.position.x + -10f, transform.position.x + 10f);
randomYposition = Random.Range(transform.position.y + -7f, transform.position.y + -8f);
break;
case 2:
randomXposition = Random.Range(transform.position.x + 10f, transform.position.x + 11f);
randomYposition = Random.Range(transform.position.y + -8f, transform.position.y + 8f);
break;
case 3:
randomXposition = Random.Range(transform.position.x + -10f, transform.position.x + 10f);
randomYposition = Random.Range(transform.position.y + 7f, transform.position.y + 8f);
break;
}
spawnPostion = new Vector3(randomXposition, randomYposition, 0f);
newEnemy = Instantiate(BossObject, spawnPostion, Quaternion.identity);
}
}
Spawner GameObject

BossObject assigned to spawner script
