Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
mpewsey authored Aug 9, 2024
1 parent b89c4fc commit de424a4
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion README.md
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);
}
}
```

0 comments on commit de424a4

Please sign in to comment.