Tag: unity

  • Get-text style localization in Unity

    In past Unity projects I have used basic string table lookup to localize UI text using carefully named keys. Whilst straightforward in terms of implementation this has a number of downsides such as being unable to properly handle the plural forms of some languages; not to mention the problem of having to come up with meaningful keys and locating strings in source code.

    Continue reading...

  • Installing npm packages into a Unity project

    Installing npm packages that are enabled to work with the unity3d-package-syncer tool is a fairly straightforward process!

    Continue reading...

  • Creating an npm package with DLLs instead of scripts

    The overall process is essentially the same as before except source files should be placed into a folder somewhere outside of the “assets” folder. A workflow can then be added using an npm script, a makefile, a shell script, a batch file, a gulp file, or whatever type of automation system that you prefer to use to initiate the building of the DLLs.

    Continue reading...

  • Structuring an npm package for Unity

    As with all npm packages; each package requires a “package.json” file to identify the package and any dependencies that it may have.

    Continue reading...

  • Package management for Unity projects

    As many of us have found; when working with even small projects you end up having many variations of reusable source code scattered across the projects. In some situations you will even find yourself having a project that has many versions of the exact same JSON library since each asset bundles it within a unique (or sometimes clashing) namespace.

    Continue reading...

  • Managing states with a lightweight FSM

    Games will typically have a number of states and sub-states and there are endless ways in which these states can be defined from using a switch statement, to using delegates, state pattern, coroutines, scenes, animation events, etc. Each approach brings its own advantages and disadvantages and some are better suited depending on the use case.

    Continue reading...

  • Tweening with DOTween

    There are several really good tweening libraries for Unity although I must say DOTween is my favorite since it has a wealth of features and performs well even on mobile. DOTween is open source although there is a DOTween Pro version which includes extra features such as visual editors but most importantly allows you to show some support to the fantastic developer of this asset.

    Continue reading...

  • Services and configuration assets for Unity projects

    With many of the projects that I have worked on it has been necessary to support a variety of build targets that are either configured differently or make use of entirely different services. In early projects I would simply use the various symbols that Unity defines such as UNITY_ANDROID but this falls short when supporting multiple Android based platforms. Not to mention dealing with projects that contain multiple reskins of the same core game each with a range of different platforms.

    Continue reading...

  • Separation of concerns with Unity UI

    I have worked with various interpretations of MVC-like patterns over the years and have experimented a lot with applying them to UIs in Unity. The patterns that I found to work best with nGUI and uGUI are MVP (Model-View-Presenter) (passive view) and MVVM (Model-View-ViewModel).

    Continue reading...

  • Managing and reporting player achievements

    When implementing goals such as achievements I like to keep the detection logic separate from the main game logic wherever possible. Otherwise it is easy to end up with spaghetti where achievements are being reported all over the place. One way to separate this cross cutting concern is to have each goal monitor the game’s state to detect success or even failure.

    Continue reading...