com.amanotes.extensions
v1.1.0
Published
Zero-dependency C# and Unity extension methods and utilities. Pick what you need.
Maintainers
Readme
AmaExtensions
Package: com.amanotes.extensions v1.1.0
Unity: 2022.3+
Namespace: Amanotes.Orchestra
Zero-dependency C# and Unity extension methods and utilities. Pick what you need.
Included Extensions
DateTimeExtensions— epoch conversion (ToEpoch,EpochToLocalDateTime)DictionaryExtension—GetValueOrDefaultEnumerableExtension—WithIndices, min/max selectorsListExtensions—Resizefor generic lists,ResizeChildrenfor Transform children with pooling,PickRandomUnityExtension—GetOrAddComponent,HasComponent,FindChild<T>,GetHierarchyName,IsNullSafeFileUtils— cross-platform persistent file read/write/delete underLibrary/OrchestraSDK(editor) orpersistentDataPath(runtime)
Quick Start
// Epoch conversion
long epoch = DateTime.UtcNow.ToEpoch();
DateTime local = epoch.EpochToLocalDateTime();
// Get or add component
var rb = gameObject.GetOrAddComponent<Rigidbody>();
// Find child by path
var label = transform.FindChild<TextMeshProUGUI>("Header/Title");
// Resize children to match data count
container.ResizeChildren<ItemView>(prefab, dataCount, (i, item) => item.Refresh(data[i]));
// File persistence
string path = FileUtils.GetPath("save.json");
FileUtils.WriteAllText(path, json);
string json = FileUtils.ReadAllText(path);Installing in your project
Add to your Packages/manifest.json:
{
"dependencies": {
"com.amanotes.extensions": "1.1.0"
},
"scopedRegistries": [
{
"name": "npmjs",
"url": "https://registry.npmjs.org/",
"scopes": [
"com.amanotes"
]
}
]
}Then open Unity — the Package Manager will resolve and download the package automatically.
