This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
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

–1 vote

maybe try out

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

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

by (20 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 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.