How to grey out whole control in Unity3d?
Hello,
I have a control which has a image brush background, some child image controls, and some other elements. I want ot grey out whole control when it is disabled.
After a quick searching, I found GrayScaleEffect is not supported. Is there a good way to do this?
I have a control which has a image brush background, some child image controls, and some other elements. I want ot grey out whole control when it is disabled.
After a quick searching, I found GrayScaleEffect is not supported. Is there a good way to do this?
-
sfernandez
Site Admin
- Posts: 2991
- Joined:
Re: How to grey out whole control in Unity3d?
Hi,
You can just add a Border overlay inside your ControlTemplate that is only shown when control gets disabled:
It only needs to be on top of other elements of the control template.
You can just add a Border overlay inside your ControlTemplate that is only shown when control gets disabled:
Code: Select all
<ControlTemplate TargetType="...">
<Grid>
...
<Border x:Name="DisabledOverlay" Background="#8888" Visibility="Collapsed"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="DisabledOverlay" Property="Visibility" Value="Visible"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
Re: How to grey out whole control in Unity3d?
I have not try the code above, I think it is not a graycale effect, the formula for converting RGB to gray is R*0.299 + G*0.587 + B*0.114.
So that will be fine if we can specify the alpha blend function for the overlay border.
So that will be fine if we can specify the alpha blend function for the overlay border.
Re: How to grey out whole control in Unity3d?
We are working in the effects architecture that will allow you to achieve more flexibility for things like this. For now, there is now way to change the alpha blending function being used. We use the standard Over as in WPF.
-
sfernandez
Site Admin
- Posts: 2991
- Joined:
Re: How to grey out whole control in Unity3d?
We don't have support for effects and alpha blending function cannot be customized in NoesisGUI.
That is why I suggested to simply use a semitransparent grey border as an alternative to get a disable look.
That is why I suggested to simply use a semitransparent grey border as an alternative to get a disable look.
Who is online
Users browsing this forum: Ahrefs [Bot], Polymorph and 7 guests