Tag: JavaScript

Unity 5 vs Unreal Engine 4

With over four and a half million registered users, Unity is the most popular game engine there is. 47% of game developers use Unity, while only 13% use Unreal Engine. But let’s examine them both….


This can be a big factor in deciding which game engine to use.

Unity’s “Personal Edition” of Unity 3D is a free, full featured engine. The professional edition, Unity Pro is $1500 per major release or $75/month. If you have Unity Pro, you get features such as a customizable splash screen, beta access, unlimited revenue and funding, Unity Analytics Pro, source code access, and much more. If your game makes above a hundred grand in annual gross revenue, you must purchase Unity Pro.

Unreal Engine 4 was previously $19 a month, but as of March 2015 Unreal has been and will be free, and you get the C++ source code. Once your game ships, you pay Epic Games 5% of your quarterly gross revenue per product after your make your first three grand.


Both engines have a very active communities, with discussion forums and answers hubs, as well as great documentation, tutorials, and wikis.

Unreal’s documentation is stellar, very well written with great explanations and screenshots.  While Unity’s docs are also great, they have some room to improve.

Unity has an amazing number of video tutorials on learn.unity3d.com. They have hundreds of professional tuts uploaded so far, for beginners and advanced users, covering every aspect of the game creation process. Both engines occasionally host live seminar style training sessions (Unity more often than Unreal).


multiplatforms supported by unity more than unreal

Unreal Engine: Windows PC, Mac OS X, iOS, Android, VR, Linux, SteamOS, HTML5, Xbox One, and PS4.

Unity 3D: Windows PC, Mac OS X, Linux, Web Player, WebGL, VR(including Hololens), SteamOS, iOS, Android, Windows Phone 8, Tizen, Android TV and Samsung SMART TV, as well as Xbox One & 360, PS4, Playstation Vita, and Wii U. With over 25 platforms supported, it seems Unity is the winner in this area.



unity book of the dead vs unreal graphics
Unity “Book of the Dead” demo

With the release of Unity 5 came many new features that enabled developers to make beautiful, next-gen games. Unity 2018 brought us the Scriptable Render Pipeline. Combining that with Quixel’s Megascans delivered AAA level graphics showcasing the new capability of the Unity engine. But it seems Unreal is still one step ahead in graphics; it is naturally more equipped to produce more realistic results in terrain, particles, post processing effects, shaders, and more.

Ease of Use

unity interface

Unity has always been known for their easy to use interface where beginners can jump right in and start making games. Though Unreal Engine 4 was a major improvement over UE3, they still take second place behind Unity in the area of user experience.

Both interfaces are very similar, with toolbars and settings within resizable & movable windows. Unreal’s UI is still quite bloated and complex. Everything takes longer and is more complicated than it should be. Assets take a long time to import and save, and simple tasks require extra, unnecessary steps. Unity 3D is fast, and the interface is quick and responsive. It’s so light that it can run on Windows XP (SP2), while UE4 requires at least Windows 7 64-bit. Though the final product may look nicer in Unreal than in Unity, getting there can take longer and require more effort, especially for beginners.


unreal engine 4 blueprint coding

Unity games are programmed with JavaScript, C#, or Boo. Most developers use either JS or C#. It’s not required to only use one. You can use one or the other, or all three. Unreal engine ships with the Blueprints Visual Scripting system, which can be used to make an entire game, or used in combination with the somewhat faster C++ scripting. Unity 3D does not have a visual scripting system built-in (yet), however there are excellent solutions that can be purchased on the Unity Asset Store, most notably Playmaker and uScript Professional.


unity analytics gif

Unity Tech offers many amazing services such as Unity Ads, Everyplay (for recording & sharing mobile gameplay), Unity Multiplayer, Analytics, Cloud Build, Performance Reporting, Premium Support, and more.

Epic Games does not have so many services, but they have created a five million dollar development fund to “provide financial grants to innovative projects built in and around Unreal Engine 4”.


Both Unreal and Unity have great places where you can buy and sell game assets.

The Unity Asset Store has over fifteen thousand assets and 1.5 million users. Most of the assets are very affordable.

The Unreal Marketplace is much newer than Unity’s asset store, and therefore much smaller. The assets are also generally more expensive. However, they all seem to be very high quality.

If you are selling assets, note that both stores split the profit 70/30.


Both engines are fantastic game creation tools, and similar in many ways. But perhaps their best quality is that they are both free, with some revenue limitations. So you can download them both, try them out, and let me know what you think in the comments below.

All images credit unity3d.com and unrealengine.com.


Generate Project Folders Script

When creating a new project, use this simple script to generate all your folders:

// generate folders in our project
import System.IO;

@MenuItem ("Project Tools / MakeFolders #&_z")
// menuItem reads the first static function
static function MakeFolder()

static function GenerateFolders ()

var projectPath : String = Application.dataPath + "/"; // store the path for the folders

// creating the folders
Directory.CreateDirectory(projectPath + "Audio");
Directory.CreateDirectory(projectPath + "Materials");
Directory.CreateDirectory(projectPath + "Meshes");
Directory.CreateDirectory(projectPath + "Resources");
Directory.CreateDirectory(projectPath + "Scripts");
Directory.CreateDirectory(projectPath + "Shaders");
Directory.CreateDirectory(projectPath + "GUI");
Directory.CreateDirectory(projectPath + "Textures");
Directory.CreateDirectory(projectPath + "Scenes");
Debug.Log ("Folders Created");

AssetDatabase.Refresh ();


Selection Script for Unity3D

This script is royalty free; you can use it for whatever you want to. What it does is when you click an object, the object is highlighted. When you click on it again, the object is un-highlighted, back to normal.

Just copy and paste this script into your JavaScript in Unity. Then attach the script to any visible object in your scene, including 3d text.

Here it is:

// Declare our variables...

var selectedColor : Color = Color(0.2, 0.3, 0.4); //This will give us a color wheel to choose a color from.
private var isSelected : boolean = false; // Simple boolean variable. Can be either true or false.

// Okay, now for the functions.
// The function OnMouseDown means to only do whats in the function when the user clicks the mouse.

function OnMouseDown ()
//isSelected = isNotSelected...
isSelected = !isSelected;

// If it's unselected, make sure the material color is white.
if (!isSelected) {
renderer.material.color = Color.white;


// If it's selected, change the material color to the selectedColor.
if (isSelected) {
renderer.material.color = selectedColor;



// Feel free to use this script in commercial or non-commercial purposes.
// My name in the credits somewhere would be appreciated, though.

Moving Objects Through Scripting in Unity3D

You can make objects move in Unity3D without animating them. Use JavaScript! Or C#, but for right now I’m going to show you how to do it with JavaScript. That’s what most Unity developers use.

So, first create a new JavaScript and open it up. Type this in it: (don’t copy and paste, you won’t learn)

function Update () {
transform.Rotate (1,0,0);

Save that, and attach it to a GameObject. Play the game, and you will see that whatever object you have attached the script to will be rotating in the x axis. The speed of this rotation is dependent upon the frame per second of your game. So if you have a really fast computer, the object will probably be spinning quite fast.

A few tips:

Transform means location or position.
transform.Rotate means rotate the position.
That (1,0,0) means rotate in the x axis; not y, not z.
Don’t forget the semi colon at the end of line 2.

So how about we make the object rotate at a fixed speed? That’s easy enough. Type this up:

var rotateSpeed: int=4;

function Update () {

A few tips:

var means variable
int means integer
Time.deltaTime means, basically, time.
Multiply that by our variable, rotateSpeed (use the asterisk)

Make sure you save and update the script and all that and that, and you’re ready to go! If you want to change the axis of rotation, change Vector3.right to Vector3.up or Vector3.left or whatever.