Using prefab in UI buttons and/or canvas?


I’m working on my first 2D game. I have six nice prefabs (one per avatar), each of the prefabs randomly chooses among 5 different sprites for the avatar (blinking, waving, etc). I want to create a UI for changing the avatar during game play.

  1. Can I use prefabs inside Canvas as in a regular Scene? Just drag/drop avatar inside canvas doesn’t work. I see the avatar in the “scene” but not in the “game”

  2. Can I somehow use my prefabs with UI buttons?


Is your prefab a UI object (does it have a Rect Transform)? Is it in the UI layer?

Prefabs work inside a canvas as long as they’re prefabs of things that work inside a canvas.