Smidgens / unity-data

Data abstraction wrappers for Unity

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ℹ️ Features

  • ScriptableObject persistence for data.
  • Data abstraction in code.
  • Configure data sources in Inspector: static, asset, or function (reflection).
  • 🤞 Reasonably lightweight.

📦 Install

  1. Open Package Manager
  2. Paste git URL (<github_url>#<desired_tag>)

🚀 Usage

🧩 Note: To use plugin in code you need to add an assembly reference.

Reading data

using Smidgenomics.Unity.Data;

public class VariableTest : MonoBehaviour
{
    public Readable<int> num1;
    public Readable<int> num2;

    private void Awake()
    {
        Debug.Log("Number 1: " + num1.Value);
        Debug.Log("Number 2: " + num2); // implicit conversion
    }	
}

Custom types

using UnityEngine;
using System;
using Smidgenomics.Unity.Data;

[Serializable]
class MySerializedType
{
    public int a, b, c;
}


// inherit from ScriptableValue<>
class MyCustomAsset : ScriptableValue<MySerializedType> { }

About

Data abstraction wrappers for Unity

License:MIT License


Languages

Language:C# 100.0%