- Home /
How do i change a sprite when another gameobject with the same prefab is colliding / is near
I want to make it so that when the player places two blocks of for example grass next to eachother they get edges the left edge on the left side and the right edge on the right side. And if they are 3 blocks together or more there will be middle sprite(s) with no edges. I'm working with like 100 sprites and i managed to hardcode 3 of them together in a row as i wanted them to look like. But i can't hardcode it when the player is supposed to place it .
Sorry for the bad drawing but hopefully you understand what i mean Would appreciate any help .
Answer by JonPQ · Jun 18, 2020 at 06:30 PM
Try using Spite shape or TileMaps for making your levels...
Sprite Shape https://www.youtube.com/watch?v=wumwrMori1Y
TileMaps https://www.youtube.com/watch?v=ryISV_nH8qw https://www.youtube.com/watch?v=fmNtibNWPhc
Im using perlin noise so that wouldnt work. and when they place the blocks it would also look like the solo sprite. ty though
Your answer
Follow this Question
Related Questions
How do i change a sprite when another gameobject with the same prefab is colliding / is near 1 Answer
Set default length for an array of elements of a custom class in inspector 0 Answers
Checking for overlaping sprites in an array 1 Answer
Unity streching sprite gameobject to fit two positions. 1 Answer
Alter a GameObjects(Clone) array from another script C# 0 Answers