i've seen this question asked online a bunch but the solution was never typed out in script, which is what i'm trying to figure out. I'm instantiating an object every 4 seconds and that works fine. but the prefab i'm instantiating is bigger in the game. What's weird is that in the scene view (while the game is playing) the prefab is the correct size. What is also odd is that the enlarged version is that of the original sprite scale. But I have other prefabs with edited scales that instantiate from plenty of other scripts correctly. So what I'm trying to do is to tell the script to instantiate this prefab at the local scale, because I read that it may be a world scale issue. My question is, how do I type that out???? I tried going, Instantiate (enemy, transform.position * transform.localScale.x, transform.rotation * transform.localScale.y); but that didn't work out obviously :/
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class enemySpawnerBasic : MonoBehaviour {
public GameObject enemy;
public Transform enemys;
public float spawnTimer = 0f;
public float spawnDelay = 4f;
private bool spawned;
void Update ()
{
SpawnEnemy ();
spawnTimer -= Time.deltaTime;
}
void SpawnEnemy()
{
if (!spawned && spawnTimer <= 0) {
Instantiate (enemy, transform.position, transform.rotation);
spawnTimer = spawnDelay;
}
}
}