MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / instance_create

Method instance_create

modules/gdscript/gdscript.cpp:415–434  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

413}
414
415ScriptInstance *GDScript::instance_create(Object *p_this) {
416 ERR_FAIL_COND_V_MSG(!valid, nullptr, "Script is invalid!");
417
418 GDScript *top = this;
419 while (top->_base) {
420 top = top->_base;
421 }
422
423 if (top->native.is_valid()) {
424 if (!ClassDB::is_parent_class(p_this->get_class_name(), top->native->get_name())) {
425 if (EngineDebugger::is_active()) {
426 GDScriptLanguage::get_singleton()->debug_break_parse(_get_debug_path(), 1, "Script inherits from native type '" + String(top->native->get_name()) + "', so it can't be assigned to an object of type: '" + p_this->get_class() + "'");
427 }
428 ERR_FAIL_V_MSG(nullptr, "Script inherits from native type '" + String(top->native->get_name()) + "', so it can't be assigned to an object of type '" + p_this->get_class() + "'" + ".");
429 }
430 }
431
432 Callable::CallError unchecked_error;
433 return _create_instance(nullptr, 0, p_this, Object::cast_to<RefCounted>(p_this) != nullptr, unchecked_error);
434}
435
436PlaceHolderScriptInstance *GDScript::placeholder_instance_create(Object *p_this) {
437#ifdef TOOLS_ENABLED

Callers 15

_debug_createMethod · 0.45
Path3DMethod · 0.45
VisualInstance3DMethod · 0.45
_create_debug_shapeMethod · 0.45
_create_debug_shapeMethod · 0.45
_update_debug_shapesMethod · 0.45
NavigationObstacle3DMethod · 0.45
_update_debug_pathMethod · 0.45
_update_debug_meshMethod · 0.45
_update_debug_meshMethod · 0.45
_notificationMethod · 0.45

Calls 5

StringClass · 0.50
is_validMethod · 0.45
get_nameMethod · 0.45
debug_break_parseMethod · 0.45
get_classMethod · 0.45

Tested by

no test coverage detected