-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
25 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,25 @@ | ||
# SturdyPath | ||
# Sturdy Path | ||
|
||
Sturdy Path is a Godot .NET addon that provides a way to reference a scene or resource by path, in a manner that won't break when moving files around within the project. This is accomplished by keeping track of the target file's `uid://` path, which is invariant of the file's location within the project. | ||
|
||
![image](https://github.com/user-attachments/assets/5efec515-aa99-4f41-a93e-d01a8d8e5a43) | ||
|
||
## Example Usage | ||
|
||
```BattleEffect.cs | ||
using MPewsey.SturdyPath; | ||
|
||
public partial class BattleEffect : Resource | ||
{ | ||
// Create an exported SturdyPathRef property for the scene or resource you wish to reference by path. | ||
[Export] public SturdyPathRef VfxScenePath { get; set; } | ||
|
||
// Use the SturdyPathRef.Load method to load the resource for use per typical Godot usage patterns. | ||
public void SpawnVfx(Node parent) | ||
{ | ||
var scene = VfxScenePath.Load<PackedScene>(); | ||
var vfx = scene.Instantiate(); | ||
parent.AddChild(vfx); | ||
} | ||
} | ||
``` |