npm.vanilla.plus Unity scoped package registry

vanilla.type-menu

Type Menu โ€” Type Menu offers developers attributes allowing them to easily populate fields that are using the SerializeReference attribute.

latest 4.2.0 9 versions token required

Install

# Unity: add the scoped registry, then Window > Package Manager > My Registries
# npm:
npm install vanilla.type-menu --registry=https://npm.vanilla.plus

Dependencies

None.

Readme

Type Menu

Type Menu is part of the Vanilla For Unity SDK.

Type Menu allows users to use a menu to populate fields using the SerializeReference attribute.

Type Menu is a heavily stripped down variation of SerializeReferenceUI by Textus Games.


Installation

Vanilla Plus packages are installed through Unity's Package Manager using a scoped registry. Open your Unity Project of choice and select:

> Edit menu > Project settings > Package Manager > Scoped Registries > Plus button

Then add:

name: Vanilla Plus url: https://registry.npmjs.com Scopes: vanilla.plus


Usage

Instead of beginning new classes from MonoBehaviour, you can try the inherited default class VanillaBehaviour.

public class MyClass : MonoBehaviour
{

    [Serializable]
    public class Fruit
    {

        [SerializeField]
        public Color color;

    }

    [Serializable]
    public class Apple : Fruit
    {

        public Apple() => color = Color.red;

    }

    [Serializable]
    public class Banana : Fruit
    {

        public Banana() => color = Color.yellow;

    }

    [Serializable]
    public class Grape : Fruit
    {

        public Grape() => color = Color.green;

    }
    
    
    [SerializeReference]
    [TypeMenu]
    [TypeMenuOnlyFilter(typeof(Fruit))]
    public Fruit fruit;

}

Contributing

Please don't. I have no idea what a pull request is and at this point I'm too afraid to ask.

If you hated this package, let me know.


Author

Lucas Hehir


License

The Unlicense

Versions

VersionPublishedDownload
4.2.0 latest 2023-12-04 tarball
4.1.0 2023-12-01 tarball
4.0.1 2023-11-27 tarball
4.0.0 2023-11-27 tarball
3.1.0 2023-11-14 tarball
3.0.4 2023-07-10 tarball
3.0.3 2023-07-07 tarball
3.0.2 2023-07-06 tarball
3.0.1 2023-07-05 tarball