Failing to get refrence to Animation Player node. Im new to coding and any help is much apprecitated :)

Godot Version

4.2.2.stable

Question

Hi! Very new to coding and have been following tutorial on starting basic weapon manager and ran into a problem. My animation player Node isn't being found. Struggling to understand what's the issue. The verbatim error message reads "*Weapons_Manager.gd:3 @ _ready(): Node not found: "%AnimationPlayer" (relative to "/root/World/Player/Head/Camera3D/Weapons_Manager").*"

extends Node3D

@onready var Animation_Player = get_node("%AnimationPlayer")

var Current_Weapon = null

var Weapon_Stack = [] #avalible weapons

var Weapon_Indicator = 0

var Next_Weapon: String

var Weapon_List = {}

@export var  _weapon_resources: Array[Weapon_Resource]

@export var Start_Weapon: Array[String]

func _ready():
	Initialize(Start_Weapon) #enter_state_machine 

func Initialize(_start_weapons: Array):
	for weapon in _weapon_resources:
		Weapon_List[weapon.Weapon_Name] = weapon

	for i in _start_weapons:
		Weapon_Stack.push_back(1)#Add out start weapon
	
	Current_Weapon = Weapon_List[Weapon_Stack[0]] #set first weapon to stack to current
	enter()


func enter():
	Animation_Player.queue(Current_Weapon.Activate_Anim)

func exit():
	pass

func Change_Weapon():
	pass

Did you make your AnimationPlayer node to be “accessed as unique name”?
See this page here that explains it:

If this doesn’t help your case, please send a screenshot of your scene structure.

Yep that was it :+1:! I seem to have a problem with my array now but I’m gonna try to spend sometime figuring it out.

1 Like