Unity5 Implementations (aka How to do shit)

In Unity5 there are often many different ways to accomplish your goals.  Additionally there are many different things you can do but it isn’t always obvious that they are possible or how to do them.  This page shows you implementations of things that can be done in Unity3D v5 which is why I subtitled this article: How to do shit.

Inversion Of Control

If you want to do Inversion of Control or Dependency Injection in Unity this is how

https://strangeioc.github.io/strangeioc/

and use UNIRx for less tightly coupled code

https://ornithoptergames.com/reactiverx-in-unity3d-part-1/

or

https://github.com/neuecc/UniRx/blob/master/README.md

How to make things move smoothly

I was looking into available “tweening systems” this evening and found more than I bargained for:

Tweening Systems:

  1. iTween is the most popular but everyone complains about it having garbage collection problems.
  2. DoTween and LeanTween are the runners up in the popularity contest but they don’t have any GC issues and are probably better choices overall
    1. DoTween is documented better and some say is laid out better and is perhaps a more “complete”package but it requires that you get comfortable with lambda expressions
    2. LeanTween has less documentation and examples but many people say it is straightforward, and incredibly fast
    3. They are both free and open source

Alternatives:

Theres this package called “Movement Over Time” which apparently does things different than a tweening system and is “more like a whole new way of thinking of and doing movement in your game” (from one of the reviews on the asset store).  the same reviewer also said “I am amazed by all the new things I can do in only a couple of lines of code in this framework that seemed impossible before.”

Then I learned about Animation Curves which are built in and can apparently be used in the context of lerping to make that process entirely easy:  transform.position = Vector3.Lerp(fromPosition, toPosition, animationCurve.Evaluate(t));

In the process I learned more about events and delegates which is really powerful shit

How to set pseudo breakpoints

Just put this in your code and the unity editor will pause when it is hit.

#if UNITY_EDITOR if( Application.isEditor ) UnityEditor.EditorApplication.isPaused = true; #endif

Audio

Some say not even to try to use Unity’s built-in audio system but to use Fabric instead: http://www.tazman-audio.co.uk/?page_id=73

It looks like you have to setup an account to download but otherwise it is free for Indie studios and has a licensing payment plan not-unlike Unity itself.

Trying things out quickly in the editor

Add a button or context menu tag to your code

https://docs.unity3d.com/ScriptReference/ContextMenu.html

    [ContextMenu ("Do Something")]
    void DoSomething ()
    {
        Debug.Log ("Perform operation");
    }

About automating Unity builds with Jenkins

How to make a map from an excel spreadsheet

Tile Based Map Generation with SabreCSG

How to make Editor Scripts

Heres an article about a number of things including Creating Editor Scripts.

Tile Based Map Generation with SabreCSG

 

Terrains

This shows how to draw a pattern and make a terrain out of it!

 

This shows how to make a terrain in Unity that resembles a part of the planet ear

Simplest setting of HUD text

Making the Graphics better in Unity (more like Unreal)

Making a High Score Screen

Making Warp Points

 

Simplest Texture application in Unity3D

 

Lists of other implementations

Here is a large list of GIFs of Unity tips and tricks

 

 

By | 2018-04-17T18:40:35+00:00 August 15th, 2017|Uncategorized|