Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- public class EnvMovment :MonoBehaviour
- {
- [SerializeField]
- private float scrollspeed;
- [SerializeField]
- private int packcount = 10;
- [SerializeField]
- private GameObject[] envpacks;
- private void Start()
- {
- float counter = 0;
- for (int i = 0; i < packcount; i++)
- {
- var envprefab = Instantiate(envpacks[UnityEngine.Random.Range(0, envpacks.Length)],
- new Vector3(counter, 0, 0), Quaternion.identity);
- envprefab.transform.parent = this.transform;
- counter += 70f;
- }
- }
- // update is called once per frame
- void Update()
- {
- transform.position -= new Vector3(0, 0, scrollspeed * Time.deltaTime / 10);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement