Grey coloring at in child objects?
Hello. Could you help me find script for next task. Some times ago, 4 yers I find script which change color all in child objects by grey. But I lost it, and can not find script again.
No reason how many deep structure was all was gray. script had slider which can controlled and create smooth changing. They work at Unity Canvas
[1]: /storage/temp/187817-screenshot-11.png Structure:
- Main Grey layer with images script, grey scale script,
>- res A
>>- res Aa
>>- res Ab
>- res B
>- res C - List item
No reason how many deep structure was all was gray. script had slider which can controlled and create smooth changing. They work at Unity Canvas
Answer by LucasMartin · Oct 24, 2021 at 03:37 PM
I did not understand very much what you need, so pardon me if answer you wrong. ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ You could create a new script and attach it to the "grey render zone" object. ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ The script would look like this: ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
using UnityEngine;
using UnityEngine.UI;
public class ChangeGray : MonoBehaviour
{
[Range(0.0f, 1.0f)]
[SerializeField] private float transparency;
private Image panel;
private void Awake()
{
panel = GetComponent<Image>();
}
private void Start()
{
panel.color = new color (panel.r, panel.g, panel.b, transparency);
}
}
Your answer
Follow this Question
Related Questions
Changing order in layers at runtime with a coroutine 0 Answers
Player is not changing color from hitting enemy 0 Answers
Mesh not being rendered in build 0 Answers
How can I change one canvas image to another? 1 Answer
2d unity game Camera issue 0 Answers