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. Code (CSharp): 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".
Make the lights children on a parent "Lights" object, then: Code (CSharp): public GameObject Lights; // drag-drop this in Inspector //in function Lights.SetActive(true); // false for off
Thank you, though if I'm trying to change the intensity, how do I refer to that in script? Also, if I am trying to create several sets of lights which light up independently of one another, do I still child them under lights?
To change intensity, read this: https://docs.unity3d.com/ScriptReference/Light-intensity.html 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.
Thanks, I appreciate the help. I wish more of the help pages and tutorials explained application over what the thing just does.