I need my GameObject to Spawn in front of my sprites

Hey guys,

I’ve been having issues spawning things into my game for awhile. However, I’ve almost got them spawning in perfectly and I just need a little help!

My game is spawning in an object that is basically just a button, and when it spawns in, it is behind all of the sprites on my Canvas. I had to change the Sorting Layer for the sprites earlier, because spawning the object in was causing them to all disappear, but now I can’t get my new spawned object to spawn in front of those sprites!

I’ve tried dragging the new object around in my Canvas hierarchy, and that hasn’t fixed it, and I’ve tried altering my Z value. I’ve also tried changing the Object Layer as well, and nothing. I tried to see if I could apply a sorting layer to my new objects, but it doesn’t look like buttons have that option. Can anyone suggest anything that might work?

Thanks

Have a look at this answer:

I was able to come up with an answer for my own question after playing around with everything a little bit. I created two canvases, one for the Foreground Buttons and one for the Background Images. I placed all of my buttons in the Foreground Canvas, and all of my Sprites in the Background Canvas. After that, I was able to apply Sorting Layers to the Canvases themselves, and was able to put the Background Canvas behind the Foreground Canvas! Hope that helps anyone having the same problem!