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'm trying to load a scene PlayerBattler which inherits from another scene called BattlerBase, which in itself inherits from KinematicBody2D. However, when I attempt to load PlayerBattler with ResourceLoader, I get an error saying "No loader found for resource: res://path", and it fails to load. Loading BattlerBase works fine, so I assume this has something to do with PlayerBattler's inheritance. Does anyone know why this is happening, and is there some kind of workaround for this?

in Engine by (28 points)

res://path is not a valid resource path. Are you sure you are trying to load your resource using a valid path? Can you show the code where you do this?

Yes, I'm using a valid path. That was just there as an example. The code looks like this, but the path is stored in a string in an autoload:

PackedScene NewBattler = ResourceLoader.Load(PartyMember.BattlerPath) as PackedScene;
BattlerBase NewBattlerConvert = NewBattler.Instance() as BattlerBase;
BattlerList.Add(NewBattlerConvert);
PlayerParty.Add(NewBattlerConvert);

BattlerPath = "res://Scenes/Entities/Battle/Party/PlayerBattler.tcsn";

Which path do you get if you print PartyMember.BattlerPath? How is that variable initialized?

I probably could've explained this a little better. The first four lines there are from BattleWorld.cs, and the string with the path is from another script. I've already checked and yes, that first line is loading res://Scenes/Entities/Battle/Party/PlayerBattler.tcsn. It's a bit of a lengthy process, I have an autoload called PlayerManager with a List called Party. Party currently holds another autoload holding the stats of one specific party member, and that there holds the BattlerPath string. PartyMember.BattlerPath is based on this foreach:

foreach (BaseStats PartyMember in PlayerManager.Party)

There's probably a more efficient way to do all this, but that's not my concern right now.

At this point I (or devs) would need a minimal reproduction project to see where the issue is.

I just tried to reproduce it in a new project, but it ended up working like it's supposed to, so I'm not entirely sure what to say. Clearly this'll take a little more looking into.

1 Answer

0 votes

Okay, so the main project is just working like it should now. I couldn't possibly tell you why it's working, all I did was put the path directly into ResourceLoader.Load() then swap it back out for PartyMember.BattlerPath, but it's working now.

by (28 points)
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.