public static void CreateFromPrefab(Transform spawner) { SpawnedCube cube = Instantiate(prefab); cube.transform.parent = GameObject.Find("Cubes").transform; cube.transform.rotation = spawner.rotation; Vector3 position = spawner.position + (spawner.forward * GameValues.Spawners.spawnDistance); position.y = GameValues.Spawners.cubeHeight / 2; cube.transform.position = position; }
public void SpawnCube() { SpawnedCube.CreateFromPrefab(player.transform); }