0 votes

'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()

Godot version Godot_v3.4.4-stable_mono_win64
in Engine by (15 points)
retagged by

1 Answer

+1 vote
Best answer

Try this:

ResourceLoader.Load<PackedScene>("res://Player.tscn").Instance();
by (1,067 points)
selected by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.