'How to make unity 2d repeating world in game Top Down?
I am currently making a Top Down Shooter game and I need the card not to run out, I have 4 pieces of ready-made cards and I need them to appear randomly. I would like to use Object Pool. I can't handle it in any way. Please help me. There is a basic code. Help me finish the code pls.
private float _spawnRadius = 7;
[SerializeField] private Transform _pointTop;
[SerializeField] private Transform _pointRight;
[SerializeField] private GameObject _prefab;
void Update()
{
Vector2 spawnPos = GameObject.FindWithTag("Player").transform.position;
spawnPos += new Vector2(_pointRight.position.x, _pointTop.position.y) * _spawnRadius;
Instantiate(_prefab, spawnPos, Quaternion.identity);
}`
I tried all the ways, but I can't do anything to create objects behind the camera, but it turns out that it is just being created on the spot. I hope my problem was clear to you!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
