So, this is probably a dumb question, but I haven’t been able to find a straight answer. I’m trying to reference a child of a child which is a light that I’d like to increase the intensity of. I’d like the lights to light up when the mouse is over the parent.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class forgeClick : MonoBehaviour {
private void OnMouseDown()
{
Debug.Log("This is the Forge");
}
private void OnMouseOver()
{
Debug.Log("Mousing over Forge");
}
The object of this script is “forge”, the child of this object is “forgeLights”, and the two children of that which I want to affect are “leftForgeLight” and “rightForgeLight”.
You can really do what you want. If you have sets of lights, you could put them in groups as children of Lights. That way you could enable/disable Lights for all the lights, and then have different groups of lights you could adjust. But that’s really up to you and should be decided by what you’re trying to achieve in your project.