1
\$\begingroup\$

Like the question describes I want to fade out/in all UI-Elements belonging to a parent canvas.

So things I got are :

  • A World-Canvas which contains multiple UI-Items
  • A script which can fade one color depending how close my cursor comes to that item

Things I want :

  • A script which can fade my whole canvas without attaching each single Element with a color property to it

Thoughts :

  • This would most likely work with a script which searches all Text children and Image children of the canvas, but I think that would be rather poorly performing code

I'm totally fine if there is no better solution as the mentioned one, but I would be annoyed if I implement it that way and there is a simple trick I don't know about :)

\$\endgroup\$
1
\$\begingroup\$

I think you can simply use a Canvas Group component on the top level canvas. It has an Alpha property that you can easily modify with a script.

https://docs.unity3d.com/Manual/class-CanvasGroup.html

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ That's great I totally missed that! \$\endgroup\$ – TobiasW Oct 28 '16 at 6:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.