1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-08 12:40:44 +00:00

Allow Ref instantiate to accept constructor args

This commit is contained in:
Thaddeus Crews
2024-02-10 13:19:14 -06:00
parent 4e990cd7e5
commit b3cac9c092
2 changed files with 4 additions and 3 deletions

View File

@@ -665,7 +665,7 @@ RemoteDebugger::RemoteDebugger(Ref<RemoteDebuggerPeer> p_peer) {
// Performance Profiler // Performance Profiler
Object *perf = Engine::get_singleton()->get_singleton_object("Performance"); Object *perf = Engine::get_singleton()->get_singleton_object("Performance");
if (perf) { if (perf) {
performance_profiler = Ref<PerformanceProfiler>(memnew(PerformanceProfiler(perf))); performance_profiler.instantiate(perf);
performance_profiler->bind("performance"); performance_profiler->bind("performance");
profiler_enable("performance", true); profiler_enable("performance", true);
} }

View File

@@ -212,8 +212,9 @@ public:
reference = nullptr; reference = nullptr;
} }
void instantiate() { template <typename... VarArgs>
ref(memnew(T)); void instantiate(VarArgs... p_params) {
ref(memnew(T(p_params...)));
} }
Ref() {} Ref() {}