- Home /
Spawning bug with scale and position.
I am trying to use a script to spawn different humanoids, however sometimes when I already see a humanoid appear and walk, it can change a little bit in a scale or a position can move lower below the ground level. The original spawning position is fine. I have tried to use SetParent set to false, however it doesn't change the situation. I attach an image example below.
![public class Spawner1 : MonoBehaviour
{
public GameObject[] humans;
public Vector3 SpawnValues;
Transform newParent;
int RandomHuman;
//2nd
float SpawnStartDelay = 0;
float SpawnRate = 3.0f;
void Start()
{
InvokeRepeating("Spawn", SpawnStartDelay, SpawnRate);
}
void Update()
{
}
void Spawn()
{
Debug.Log("Spawn Function Activated");
RandomHuman = Random.Range(0, humans.Length);
GameObject spawnedPrefab = Instantiate(humans[RandomHuman], transform.position, transform.rotation);
spawnedPrefab.transform.SetParent(newParent);
//spawnedPrefab.transform.SetParent(transform.parent, false);
spawnedPrefab.transform.SetParent(newParent, false);
}
}][1]
[1]: /storage/temp/130755-1.jpg
1.jpg
(17.3 kB)
Comment