All Projects → rotorz → Unity3d Class Type Reference

rotorz / Unity3d Class Type Reference

Licence: mit
An example npm package that contains some example assets to demonstrate how to create a package for use in games made using the Unity game engine.

Labels

Projects that are alternatives of or similar to Unity3d Class Type Reference

Softmaskforugui
UI Soft Mask is a smooth masking component for Unity UI (uGUI) elements.
Stars: ✭ 688 (+4200%)
Mutual labels:  unity3d
Unite2017
Sample project for Game Architecture with Scriptable Objects from Unite Austin 2017
Stars: ✭ 762 (+4662.5%)
Mutual labels:  unity3d
Pcx
Point cloud importer & renderer for Unity
Stars: ✭ 806 (+4937.5%)
Mutual labels:  unity3d
Ffmpegout
Video capture plugin for Unity with FFmpeg.
Stars: ✭ 700 (+4275%)
Mutual labels:  unity3d
Unity Preview
GitHub for Unity, the Preview!
Stars: ✭ 725 (+4431.25%)
Mutual labels:  unity3d
Fungus
An easy to use Unity 3D library for creating illustrated Interactive Fiction games and more.
Stars: ✭ 786 (+4812.5%)
Mutual labels:  unity3d
Restclient
🦄 Simple HTTP and REST client for Unity based on Promises, also supports Callbacks! 🎮
Stars: ✭ 675 (+4118.75%)
Mutual labels:  unity3d
Utymap
Highly customizable library for procedural world generation based on real map data
Stars: ✭ 825 (+5056.25%)
Mutual labels:  unity3d
Unity Quicksheet
Unity-QuickSheet enables you to use spreadsheet file data within Unity editor.
Stars: ✭ 742 (+4537.5%)
Mutual labels:  unity3d
Loxodon Framework
An MVVM & Databinding framework that can use C# and Lua to develop games
Stars: ✭ 802 (+4912.5%)
Mutual labels:  unity3d
Unitycodes
SpringGUI是对UGUI的拓展,提供十多种UI组件用于快速开发。
Stars: ✭ 701 (+4281.25%)
Mutual labels:  unity3d
Radialprogressbar
Customizable radial progress bar shader for Unity3D. Allows you to set arc range, minimum and maximum colors, textures, radius, and a few more things. Create HP Bars, Speedometers, rank progress, etc!
Stars: ✭ 714 (+4362.5%)
Mutual labels:  unity3d
Sanandreasunity
Open source reimplementation of GTA San Andreas game engine in Unity
Stars: ✭ 794 (+4862.5%)
Mutual labels:  unity3d
Mybox
MyBox is a set of attributes, tools and extensions for Unity
Stars: ✭ 694 (+4237.5%)
Mutual labels:  unity3d
Geneticsharp
GeneticSharp is a fast, extensible, multi-platform and multithreading C# Genetic Algorithm library that simplifies the development of applications using Genetic Algorithms (GAs).
Stars: ✭ 813 (+4981.25%)
Mutual labels:  unity3d
Hologramshader
✏️ Test of an hologram material made in Unity.
Stars: ✭ 684 (+4175%)
Mutual labels:  unity3d
Com.unity.multiplayer.mlapi
A game networking framework built for the Unity Engine to abstract game networking concepts.
Stars: ✭ 781 (+4781.25%)
Mutual labels:  unity3d
2d Spaceshooter
A very simple 2D space shooter game made with Unity
Stars: ✭ 6 (-62.5%)
Mutual labels:  unity3d
Lasp
Low-latency Audio Signal Processing plugin for Unity
Stars: ✭ 816 (+5000%)
Mutual labels:  unity3d
Xlua
xLua is a lua programming solution for C# ( Unity, .Net, Mono) , it supports android, ios, windows, linux, osx, etc.
Stars: ✭ 7,224 (+45050%)
Mutual labels:  unity3d

unity3d-class-type-reference

An example npm package that contains some example assets to demonstrate how to create a package for use in games made using the Unity game engine.

$ yarn add rotorz/unity3d-class-type-reference

This package is compatible with the unity3d-package-syncer tool. Refer to the tools' README for information on syncing packages into a Unity project.

screenshot

Warning

Whilst we have not encountered any platform specific issues yet, the source code in this repository might not necessarily work for all of Unity's platforms or build configurations. It would be greatly appreciated if people would report issues using the issue tracker.

Usage Examples

Type references can be made using the inspector simply by using ClassTypeReference:

using Rotorz.Games.Reflection;
using UnityEngine;

public class ExampleBehaviour : MonoBehaviour
{
    public ClassTypeReference greetingLoggerType;
}

A default value can be specified in the normal way:

public ClassTypeReference greetingLoggerType = typeof(DefaultGreetingLogger);

You can apply one of two attributes to drastically reduce the number of types presented when using the drop-down field.

using Rotorz.Games.Reflection;
using UnityEngine;

public class ExampleBehaviour : MonoBehaviour
{
    // Allow selection of classes that implement an interface.
    [ClassImplements(typeof(IGreetingLogger))]
    public ClassTypeReference greetingLoggerType;

    // Allow selection of classes that extend a specific class.
    [ClassExtends(typeof(MonoBehaviour))]
    public ClassTypeReference someBehaviourType;
}

To create an instance at runtime you can use the System.Activator class from the .NET / Mono library:

using Rotorz.Games.Reflection;
using System;
using UnityEngine;

public class ExampleBehaviour : MonoBehaviour
{
    [ClassImplements(typeof(IGreetingLogger))]
    public ClassTypeReference greetingLoggerType = typeof(DefaultGreetingLogger);


    private void Start()
    {
        if (this.greetingLoggerType.Type == null) {
            Debug.LogWarning("No type of greeting logger was specified.");
        }
        else {
            var greetingLogger = Activator.CreateInstance(this.greetingLoggerType) as IGreetingLogger;
            greetingLogger.LogGreeting();
        }
    }
}

Presentation of drop-down list can be customized by supplying a ClassGrouping value to either of the attributes ClassImplements or ClassExtends.

  • ClassGrouping.None - No grouping, just show type names in a list; for instance, "Some.Nested.Namespace.SpecialClass".

  • ClassGrouping.ByNamespace - Group classes by namespace and show foldout menus for nested namespaces; for instance, "Some > Nested > Namespace > SpecialClass".

  • ClassGrouping.ByNamespaceFlat (default) - Group classes by namespace; for instance, "Some.Nested.Namespace > SpecialClass".

  • ClassGrouping.ByAddComponentMenu - Group classes in the same way as Unity does for its component menu. This grouping method must only be used for MonoBehaviour types.

For instance,

using Rotorz.Games.Reflection;
using UnityEngine;

public class ExampleBehaviour : MonoBehaviour
{
    [ClassImplements(typeof(IGreetingLogger), Grouping = ClassGrouping.ByAddComponentMenu)]
    public ClassTypeReference greetingLoggerType;
}

Contribution Agreement

This project is licensed under the MIT license (see LICENSE). To be in the best position to enforce these licenses the copyright status of this project needs to be as simple as possible. To achieve this the following terms and conditions must be met:

  • All contributed content (including but not limited to source code, text, image, videos, bug reports, suggestions, ideas, etc.) must be the contributors own work.

  • The contributor disclaims all copyright and accepts that their contributed content will be released to the public domain.

  • The act of submitting a contribution indicates that the contributor agrees with this agreement. This includes (but is not limited to) pull requests, issues, tickets, e-mails, newsgroups, blogs, forums, etc.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].