Unclaimed Package Is this your package? Claim it to unlock full analytics and manage your listing.
Claim This Package

Install via UPM

Add to Unity Package Manager using this URL

https://www.pkglnk.dev/oyvind-stromsvik-utility.git

README Markdown

Copy this to your project's README.md

Style
Preview
pkglnk installs badge
## Installation

Add **TwiiK Utility** to your Unity project via Package Manager:

1. Open **Window > Package Manager**
2. Click **+** > **Add package from git URL**
3. Enter:
```
https://www.pkglnk.dev/oyvind-stromsvik-utility.git
```

[![pkglnk](https://www.pkglnk.dev/badge/oyvind-stromsvik-utility.svg?style=pkglnk)](https://www.pkglnk.dev/pkg/oyvind-stromsvik-utility)

README

TwiiK Utility

A utility package with a few helper classes and extension methods. Tiny at the moment, but I'll keep adding to it as I go.

Features

Singleton

A generic MonoBehaviour singleton base class.

using TwiiK.Utility;

public class GameManager : Singleton<GameManager> {
    public override void Awake() {
        base.Awake();
        // Your initialization code
    }
}

// Access from anywhere
GameManager.Instance.DoSomething();

Extension Methods

Transform.Reset()

Reset a transform the same way you can in the inspector, ie. zero local position, rotation and scale.

transform.Reset();

float.Remap()

Remaps a value from one range to another.

// Remap a value from range 5-20 to range 0-1
float normalized = myValue.Remap(5f, 20f, 0f, 1f);

Vector2.Random()

Returns a random value between the x and y components of a Vector2.

Vector2 range = new Vector2(1f, 5f);
float randomValue = range.Random(); // Returns value between 1 and 5

License

MIT

Comments

No comments yet. Be the first!