Helloo There!
I’m trying to change the alpha of a gameobject with multiple child objects, but I would like to know what I am doing wrong.
btw the childs have all different mesh renderes.
this is what I have:
`using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FadeHouse : MonoBehaviour
{
void OnTriggerEnter( Collider other)
{
if(other.tag == "Player")
{
List<Renderer>()allChildRenderers;
allChildRenderers.AddRange(GetComponentsInChildren<Renderer>());
foreach (Renderer r in allChildRenderers)
{
Color c = r.material.color;
c.a = 0.5f;
r.material.color = c;
}
}
}
}`
oh and I’m getting this error:
FadeHouse.cs(13,29): error CS1002: ; expected