0 votes

I want let the player use a certain key to turn shadows on and off but do I get access to the shadows?

Also, later I want to implement this feature as a toggle button in a separate settings menu and I am unable to get access to the directional light from the settings menu. How do I do it?

in Engine by (50 points)

1 Answer

0 votes

You can access the property via the light's shadow_enabled property. So, this...

$DirectionalLight.shadow_enabled = true # (or false)

To your second question of how to access it from a button in your settings menu... That really depends on how you've put your game together, but the most likely answer is via a signal.

by (21,692 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.