Altering Script to Disable UI Toggle with Key Press

Hi guys, I completed the following tutorial -

It goes through the process of scripting flashlight mechanics.

At the moment the UI can only be seen when the ‘F’ key is pressed. I was wondering how can I alter the code so that the UI elements of the flashlight are always visible and do not need a switch or toggle ‘on’ to be seen? It would mean a lot if I can get a hand with this.

Right now, the canvas group’s alpha is being changed. So, there are a few ways around it. The simplest way is just make a second canvas for your flashlight elements so the flashlight UI doesn’t get turned off but everything under the main canvas does.

There is nothing wrong with having multiple canvases.

1 Like

Or separate everything with panels.

1 Like

Hi guys, I appreciate the replies. I fixed the issue by commenting out the lines of code 197 - 216 that involve the canvas and in the inspector I made sure the alpha group was set 1. Seemed to do the job. Thanks for the suggestions!