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

Method instance_create

modules/mono/csharp_script.cpp:2454–2475  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2452}
2453
2454ScriptInstance *CSharpScript::instance_create(Object *p_this) {
2455#ifdef DEBUG_ENABLED
2456 CRASH_COND(!valid);
2457#endif // DEBUG_ENABLED
2458
2459 StringName native_name;
2460 GDMonoCache::managed_callbacks.ScriptManagerBridge_GetScriptNativeName(this, &native_name);
2461
2462 ERR_FAIL_COND_V(native_name == StringName(), nullptr);
2463
2464 if (!ClassDB::is_parent_class(p_this->get_class_name(), native_name)) {
2465 if (EngineDebugger::is_active()) {
2466 CSharpLanguage::get_singleton()->debug_break_parse(get_path(), 0,
2467 "Script inherits from native type '" + String(native_name) +
2468 "', so it can't be assigned to an object of type: '" + p_this->get_class() + "'");
2469 }
2470 ERR_FAIL_V_MSG(nullptr, "Script inherits from native type '" + String(native_name) + "', so it can't be assigned to an object of type: '" + p_this->get_class() + "'.");
2471 }
2472
2473 Callable::CallError unchecked_error;
2474 return _create_instance(nullptr, 0, p_this, Object::cast_to<RefCounted>(p_this) != nullptr, unchecked_error);
2475}
2476
2477PlaceHolderScriptInstance *CSharpScript::placeholder_instance_create(Object *p_this) {
2478#ifdef TOOLS_ENABLED

Callers 1

reload_assembliesMethod · 0.45

Calls 4

StringNameClass · 0.50
StringClass · 0.50
debug_break_parseMethod · 0.45
get_classMethod · 0.45

Tested by

no test coverage detected