diff --git a/core/object/script_language.cpp b/core/object/script_language.cpp index cdc56e5ec51..0428caa80d0 100644 --- a/core/object/script_language.cpp +++ b/core/object/script_language.cpp @@ -704,6 +704,18 @@ bool PlaceHolderScriptInstance::has_method(const StringName &p_method) const { return false; } +Variant PlaceHolderScriptInstance::callp(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) { + r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; +#if TOOLS_ENABLED + if (Engine::get_singleton()->is_editor_hint()) { + return String("Attempt to call a method on a placeholder instance. Check if the script is in tool mode."); + } else { + return String("Attempt to call a method on a placeholder instance. Probably a bug, please report."); + } +#endif + return Variant(); +} + void PlaceHolderScriptInstance::update(const List &p_properties, const HashMap &p_values) { HashSet new_values; for (const PropertyInfo &E : p_properties) { diff --git a/core/object/script_language.h b/core/object/script_language.h index 59a43a7b297..e38c344ae57 100644 --- a/core/object/script_language.h +++ b/core/object/script_language.h @@ -454,10 +454,7 @@ public: return 0; } - virtual Variant callp(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) override { - r_error.error = Callable::CallError::CALL_ERROR_INVALID_METHOD; - return Variant(); - } + virtual Variant callp(const StringName &p_method, const Variant **p_args, int p_argcount, Callable::CallError &r_error) override; virtual void notification(int p_notification, bool p_reversed = false) override {} virtual Ref