Question by
mjtaqizade · Feb 02, 2016 at 05:19 PM ·
2dinstantiatespritesjoints
Instantiating random sprites, with no space between them?
Hi, I'm making a 2D endless runner game and so far I can instantiate some random sprites as road an move them along y axis. here is my instantiate code:
public GameObject [] Edge;
void OnTriggerExit2D(Collider2D other)
{
var newTransform = transform;
Instantiate(Edge[Random.Range(0, Edge.Length)], newTransform.position, Quaternion.identity);
}
The problem is the space between sprites because of the instantiate delay and movement of the sprites. also the size of the sprites are different. Is there a way to keep sprites besides each other? for example with joint or somthing?
Comment