Preheat the oven to 350℉. Spray a 9x13-inch baking dish with nonstick spray.
Add the sliced onions to a bowl. Drizzle with the melted butter; toss.In a small bowl, combine the sugar, garlic powder, smoked paprika, salt, pepper and cayenne. Sprinkle this mixture over the onions in the bowl; toss again.
In a medium bowl, toss the two cheeses together.Add half of the onions to the prepared baking dish. Top the onions with half of the cheese. Add the rest of the onions to the dish, and top those with the rest of the cheese. Dot the butter all over the top. Cover with foil and bake for 45 minutes.Remove the foil, and bake for an additional 15 to 20 minutes, until the onions are soft and the cheese is bubbly. Remove from the oven and let cool.