'Resource' does not contain a definition for 'Instance'

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Dice

‘Resource’ does not contain a definition for ‘Instance’ and no accessible extension method ‘Instance’ accepting a first argument of type ‘Resource’ could be found

So basically, I want to change the scenes but cant because the instance property cannot be found.

using Godot;
using System;

public class Menu : VBoxContainer 
{
    PackedScene simultaneousScene;
    public override void _Ready()
    { 	simultaneousScene = (PackedScene)ResourceLoader.Load("res://Player.tscn").instance();
    }
    public override void _Process(float delta)
    {
         GetTree().GetRoot().AddChild(simultaneousScene);
    }  
}

I’ve also tried Instance() in place of instance()

:bust_in_silhouette: Reply From: juppi

Try this:

ResourceLoader.Load<PackedScene>("res://Player.tscn").Instance();