고도엔진에서 전처리문으로 모바일과 에디터환경 나누기
extends Node2D # 또는 Node2D (2D 게임의 경우)
@export var label: Label
func _input(event: InputEvent) -> void:
# 모바일 환경에서만 실행
if OS.has_feature("mobile"):
if event is InputEventScreenTouch:
if event.is_pressed():
Jump()
elif event.is_released():
pass
# 에디터 환경에서만 실행
elif OS.has_feature("editor"):
if Input.is_action_pressed("my_input"):
Jump()
func Jump():
print("점프")
터치이벤트를 에디터와 모바일환경을 따로 나누고 싶을 때 OS.has_feature("mobile") or OS.has_feature("editor")
댓글
댓글 쓰기