Last active
November 23, 2023 18:37
-
-
Save Grunerd/d31f883cad2bf67bd15a9633debf2b96 to your computer and use it in GitHub Desktop.
Enable and toggle through Render Modes in Godot 4.x
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Taken from TokisanGames: https://www.reddit.com/r/godot/comments/d459x2/finally_figured_out_how_to_enable_wireframes_in/ | |
# There is a total of 25 draw modes at the time of this, for further information take a look at the ViewportDebugDraw-Enum: | |
# I found the first 5 to be worth using. | |
# https://docs.godotengine.org/en/stable/classes/class_renderingserver.html#enum-renderingserver-viewportdebugdraw | |
extends Node | |
@onready var vp = get_viewport() | |
func _ready() -> void: | |
RenderingServer.set_debug_generate_wireframes(true) | |
func _input(event): | |
if event is InputEventKey and Input.is_key_pressed(KEY_P): | |
vp.debug_draw = (vp.debug_draw + 1 ) % 6 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment