The Godot Community Forums are back up and running! Please read the the announcement post for important information on what happened. Thanks!

C# What am I missing?

I am trying to do HeartBeast Action RPG tutorial using C# and I'm stuck right here.

        var GrassEffect = (PackedScene)GD.Load("res://Res/Effects/GrassEffect.tscn");
        var grassEffect = GrassEffect.Instance();
        var world = GetTree().CurrentScene;
        world.AddChild(grassEffect);
        grassEffect.GlobalPosition = GlobalPosition;

Last line gives me an error:
'Node' does not contain a definition for 'GlobalPosition' and no accessible extension method 'GlobalPosition' accepting a first argument of type 'Node' could be found (are you missing a using directive or an assembly reference?)

Best Answer

  • cyberealitycybereality Posts: 1,053
    edited September 12 Accepted Answer

    Is this 2D or 3D? Because GlobalPosition is only for 2D and it looks like you're using a Node (which is for 3D). I believe you just want to change that object to Node2D if you're using 2D.

Answers

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file