Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Engine.editor_hint is always invalid #66943

Closed
TheYellowArchitect opened this issue Oct 5, 2022 · 5 comments
Closed

Engine.editor_hint is always invalid #66943

TheYellowArchitect opened this issue Oct 5, 2022 · 5 comments
Labels

Comments

@TheYellowArchitect
Copy link

TheYellowArchitect commented Oct 5, 2022

Godot version

4.0 beta2

System information

Artix (Arch Linux without systemd), NVIDIA GTX-1050 Ti

Issue description

Engine._editor_hint is a boolean value which returns true if on the editor, false if non-editor. Problem is, it doesn't work at all. It does compile without error, but whenever it checks against that logic in runtime, it gives invalid index error.

engine-editor-hint2

Steps to reproduce

  • Create a new/empty project
  • Create any kind of node
  • Attach a script to it
  • Copy-paste this code:
extends Node2D

func _ready():
	if not Engine.editor_hint:
		print("This never reaches here lol")
  • Play/Run the scene

Minimal reproduction project

See above. Just copypaste the code into 1 script lol

@TheYellowArchitect TheYellowArchitect changed the title Engine.editor_hint is always invalid (error) Engine.editor_hint is always invalid Oct 5, 2022
@gongpha
Copy link
Contributor

gongpha commented Oct 5, 2022

In 4.0, the editor_hint property was replaced with is_editor_hint method which returns boolean too.

print(Engine.is_editor_hint())

@TheYellowArchitect
Copy link
Author

is_editor_hint does work. If indeed it replaced editor_hint why is editor_hint even a choice? I thank you for fixing my mini bug, but anyway, I will keep this issue open until editor_hint is completely removed, because the user/coder will be baited by this

@akien-mga
Copy link
Member

There is a compilation error in your screenshot...

@TheYellowArchitect
Copy link
Author

@akien-mga the compilation error is on runtime. This should be caught in compiling/saving.

@TheYellowArchitect
Copy link
Author

TheYellowArchitect commented Oct 6, 2022

Nevermind, the reasoning behind compiler not catching these errors are explained in
godotengine/godot-proposals#5549

Related to this issue: #66948

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants