Search Unity

Question Trigger Light Intensity through script

Discussion in 'Scripting' started by Corrothon, Apr 22, 2021.

  1. Corrothon

    Corrothon

    Joined:
    Jun 11, 2019
    Posts:
    60
    Hello, I've been trying to change the light intensity when you walk on a trigger, I've been trying to code stuff but deleted it because it didn't work and I've searched up so much stuff on it but nothing helps.
    The thing I'm trying to accomplish is when the Player walks on a trigger the light intensity goes up but nothing seems to work. If you can help please do.

    Edit: I instead made a trigger so when you walk on it another similar light turns on. Now I fixed my own problem xd
     
    Last edited: Apr 22, 2021
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,752
    To help gain more insight into your problem, I recommend liberally sprinkling Debug.Log() statements through your code to display information in realtime.

    Doing this should help you answer these types of questions:

    - is this code even running? which parts are running? how often does it run?
    - what are the values of the variables involved? Are they initialized?

    Knowing this information will help you reason about the behavior you are seeing.

    If you are running a mobile device you can also see the console output. Google for how.