0 votes

I've already tried using GetParent().GetNodeOrNull<Position2D>("Position2D"), but when I try to use Position or GlobalPosition I get this error:

E 0:00:01.635 void Player.Fire(): System.NullReferenceException:
Object reference not set to an instance of an object. <C++ Error>
Unhandled exception <C++ source>
C:\Users\dulou\OneDrive\Documents\Game 001\Body\Player.cs:20 @ void
Player.Fire()() Player.cs:20 @ void Player.Fire()()
Player.cs:44 @ void Player._PhysicsProcess(Single )()

and this keeps happening in any kind of function or method

Godot version 3.2.3(mono)
in Engine by (27 points)

How is your scene setup?

is basically:

Player(KinematicBody2D)
---Sprite
---CollisionShape2D
---Position2D

1 Answer

0 votes

maybe try out

get_parent().get_node("nodename").Position

oh wait sry ur using c#, forget my answer xd

by (16 points)

anyway thank you xD

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 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 webmaster@godotengine.org with your username.