• Home  / 
  • Author's archive:
About the author

Jason Weimann

Unity3D Survey Results

By Jason Weimann / March 19, 2018

The Surveys..

Subscribers to my email list know that I like to send out surveys from time to time.

Sometimes it’s just spurred on by a post or video I come across, and I just want to verify the info.

Much of the time though, it’s just me, thinking about something… and wondering what everyone else thinks.

In this post, I’m sharing the results of a few of those surveys….

BUT, I’m also leaving them open, so if you want to chime in with your personal view or data points, please share 🙂


SOLID Principles

This survey left me happy, knowing that most people had at least heard of the principles, regardless if they were using them.

Coding Standards

Here, I was happy to see that my choice to ditch the _ seems to be the most popular one.  If you were wondering why I stopped using it, I talked a bit about it in this video: https://www.youtube.com/watch?v=oDVan60VBPs


This was the only survey that made me sad…  So many developers worldwide need to be paid way more (IMO)

Code Length

When it came to code length, I think most people got it right.  100-200 is a good range for a class (though many should be smaller, depending on the specifics).

Continue reading >

Build a 3rd person shooter in Unity – Part 2

By Jason Weimann / February 3, 2018

Build a 3rd person shooter from the ground up. Part 2 of this series covers weapon use (firing a gun in Unity) with raycasting to hit the correct targets.  We’ll also setup a reusable health system for our bad guys, player, and even props.  Then we’ll drop into particles for muzzle flashes and sound effect basics.



Get the Third Person Control Code

Download The Muzzle Flash Particle – —>>> HERE <<<—


Get the Gun & Health Code

Continue reading >

Build a 3rd person shooter in Unity – Part 1

By Jason Weimann / February 1, 2018

Build a 3rd person shooter from the ground up. In this series we’ll put together all essentials for a 3rd person shooter game in Unity3D. We’ll do character control, shooting, exploding, animating, making loud explosions, and more! If you want to build a third person shooter, follow along 🙂




Get the Third Person Control Code

Continue reading >

Unity3D UGUI Hold to Click Buttons

By Jason Weimann / January 30, 2018

Need buttons that don’t click instantly for your Unity3D UGUI project?  Try this simple Hold to Click script.  Use it to specify how long you want the user to hold the button before it clicks, and give the user some visual feedback on how much longer they need to hold it.  Everything ties in directly with standard Unity events, so hooking it up is no different than a standard UGUI button.

The Click to Hold Button Code

See how the click to hold button works

Continue reading >

SOLID Unity3D Code Architecture – The Open Closed Principal

Are you ready to start using the SOLID principals in your Unity3D Project?  Learn how the Open Closed Principal (the O in SOLID) can make your game easier to develop, extend, and maintain.  By using simple interfaces and separating out some code, we’ll convert a solution that’s destined for messiness into a clean and SOLID Unity3D project.


What to Look Out For

  1. Adding new functionality requires you to modify your existing classes
  2. Your class is handling different inputs in different ways to the same method.
  3. You start to see if & else if statements cluttering your code.

Ways to Implement The Open Closed Principal in Unity

  • Have your classes act on interfaces, not discrete implementations
  • Use base classes and override their functionality
  • Add events to your class and have other components on the gameobject register for those events instead of the class calling them directly


Continue reading >

Game Developer / Programmer – 2017 Holiday Buying Guide

By Jason Weimann / November 21, 2017

Storage - Samsung 960 PRO (~$150-$600)

The 960 pro is still the top performing SSD available.  But make sure your system has an available m2 slot for this special drive.

These come in a variety of sizes and the price jump goes up fast.

If you're looking for a great SSD at a slightly lower price though, go for the 960 EVO (also M.2).  The performance specs are very close and the price is about 2/3... I'm grabbing a new 1TB one for myself this holiday season.

Keyboard - Razer Black Widow Chroma V2 ($~100)

If you like tactile feedback, quick response, and awesome color customization like me, the black widow chroma 2 is a perfect fit.  The keys use Razers custom green switches, and while they feel great, it's worth noting that they are not quiet 🙂

And if you play games.. when you see the in-game support, be prepared to smile.  My favorite is in Overwatch, where the keyboard starts glowing yellow as I heal or blue when I damage boost 🙂

VR- Oculus Rift with Touch ($350-$400!)

If you read my stuff, you know that I love VR.  And while I personally prefer the HTC Vive for my big head and oddly shaped office, the Rift is just as good for 99% of people.  And it's priced perfectly for the holidays.  Keep an eye out for sales, it's planned to drop to as low as $350 this holiday season.

Update: It's live now for $350 at bestbuy (expecting amazon to pricematch) - 

Microphone - Blue Yeti (~$75-$110)

I've been using this microphone personally for about 2 years and love it.  Simply plug in the USB port and start talking.  The sound quality is great, the price is awesome (often under $100), and it looks great too (get it in just about any color).  Definitely a great choice for anyone looking to record podcasts, stream their games, or just chat with their friends online (in-fact my 15yr old just got one for his birthday after his friends kept complaining that his old mic sounded terrible).

Home Control - Google Home / Mini (~$25 / ~$90)

If you've been considering getting a digital home assistant like the echo or home, I can't reiterate how awesome they can be.  I have mine hooked up to control lights & home entertainment as well (via insteon & the logitech hub).

I also have echos in the house, and while they're a good choice as well, I've been much happier with the way google home understands what I'm asking and answers question.  (it'll search and find answers to almost anything I ask)

The Mini version just release too and will be on sale as low as $25.  I'm definitely going to pick up a few to spread around the house.

Home Control #2 - Harmony Hub + free Echo Dot (< $100)

While I love the google home, I also wanted to recommend the Harmony Hub.  It works great with both the echo & google ecosystems and can control just about any home entertainment hardware.

I have mine setup to tell google (or alexa) to turn on the TV..
The projector turns on, receiver powers up, switches to the right output, and the lights dim down.

It feels like you're in the future, and doesn't cost much at all... 
The same goes for shutdown.. no more waiting around, just tell it to shut down and everything turns off.

And of course while I wanted to recommend it, I saw that it now comes bundled with an Echo Dot for about $2 more, well worth the deal.  I'd jump on this right away.

Video Streaming - Google Chromecast (~$20)

Don't have a spare computer to hook up to your TV?  Go with a chromecast instead.  If you haven't used these, they're awesome..

You can stream straight from your phone (show your screen and share a presentation or game), or using any chromecast enabled app, the device can play video for you.  Start a youtube video, hit the chromecast button, and the chromecast takes over, your phone can turn off (or you can use it to control the video).

Sync it up with a google home to say things like "Hey Google, play my favorite youtube channel in the bedroom".  I have these on every tv in the house.. and with holiday pricing, expect to see these for around $20.

Laptop - Surface Book 2 (with GPU!) (~$$$$$)

This last recommendation is the only one I don't own personally... (though I hope to in the near future).

The surface book 2 is a huge upgrade from V1, and if you get the higher end versions, they even include a good GPU capable of running VR games.

The screen pops off to become a tablet, or you can re-connect it for more power (discrete GPU is in there), a quality keyboard, and more battery power.

I can't wait to get one myself... 

Continue reading >

Great Free 3D Models, Textures, & Assets for Unity3D

By Jason Weimann / November 11, 2017

Finding great art assets for your games is easier today than ever before.  Great art can be pretty expensive, but there are quite a few free options available where you can get high quality free 3D models, characters, textures, pbr substances, sound effects, animations, music, environments, vehicles, etc…  In this post, I wanted to share a few of my favorites.  For each type of asset, I’ve listed my favorite site to get them free.


Substance Share – https://share.allegorithmic.com/

I recently learned about this site and plugin and it’s amazing.  Simply visit the site, find the materials you like, download them and drop them into your project.

There are 100’s of materials for just about anything you could want, and they’re all customizable.


Since these are PBR materials, you can modify them easily (even as a programmer with no artistic skills it’s not tough).

Character Models & Animations

Mixamo – https://www.mixamo.com/#/?page=1&type=Character

Of all the resources shared here, this is probably my favorite.  Mixamo was purchased by Adobe a few years ago and decided to change the pricing structure.  All these models & animations were originally for sale at reasonable prices (around $15 per anim), and now they’re all completely free!  There are over 50 high quality characters you can use in your games, and 1000’s of animations.

On top of all the free stuff they provide, the mixamo system will automatically retarget their animations for your other characters.  You can bring characters that you’ve modeled, purchased, or found free in other places right into the site, apply the animations of your choice, and start using them in your game.

Look at all these characters!

And a few of the 1000’s of great animations


Sound Fx & 2D Art

OpenGameArt – https://opengameart.org/

This site has a nice variety of assets available.  There are great 2D sprites, free 3D models, music, sounds, textures, fonts, and even text files full of character names you can use.

It’s also my favorite source for free sound effects & 2D art assets.

Particles & Models (and everything else)

Unity Asset Store – https://www.assetstore.unity3d.com/en/#!/search/page=1/sortby=popularity/query=price:0

Of course every Unity developer should be utilizing the asset store.  And while I spend a lot of $$$ on assets, there are also a ton of free assets.  There are over 1509 free models alone!

This is also the best place for free particle systems, none of the competitors come close.  Of course like OpenGameArt, there are a ton of free 3d models, 2d sprites, and everything on the asset store.


Again a lot of these sites have more than I mentioned, but I wanted to focus on the areas where they stand out above the competition.  I’m also always looking for more great resources, so if you have some to recommend, please drop a comment below.


Continue reading >

Unity3D Machine Learning – Writing a custom Agent – Create your own AI Bot

I’ve been playing with the new Unity3D Machine Learning system for a few days now and made a little progress.  I wanted to share the steps I found to get a newly created agent setup and trained to complete a basic task.  In this post, you’ll see how to setup a basic agent with the goal of reaching a randomly chosen number using nothing but reinforced machine learning.  We’ll use the new Unity ML Agent system and tensorflow to create and train the agent to complete the task and discuss ways to extend this into a real game AI.

Setup Tensorflow and UnityML

If you don’t have tensorflow setup yet, you’ll need to follow the steps outlined here: https://unity3d.college/2017/10/25/machine-learning-in-unity3d-setting-up-the-environment-tensorflow-for-agentml-on-windows-10/

Video Version

Want to see this all in video?  Here ya go:

AgentML Scene Setup

Once you’ve gone through that process, open the Unity project and create a new scene.

The first thing we need is an academy.  Create a new gameobject, name it “NumberAcademy“.

Add the “TemplateAcademy” component to the “NumberAcademy“.  Our setup doesn’t need the academy to do anything special, so we can start with the basic blank academy provided in the template.

Under the Academy, create another child gameobject.  Name it “NumberBrain“.

Add a Brain component to it.

Set the State & Action size variables to 2.

Set the Action Space Type to Discrete.  We’ll be using 2 discrete actions (up or down) in our project.  We use discrete because these are represented as integers.

Set the State Space type to Continuous.  We’ll be tracking two floats, for state, so we use continuous.

Set the Brain Type to “Player

Add 2 actions.  Choose any 2 keys you want (I went with A & B), but set the Values to 0 and 1.  The key bound to value 0 decrements the #, the key bound to 1 will increment it.

The NumberDemoAgent Script

Create a new script named NumberDemoAgent.cs

Set the base class to Agent (replace the : MonoBehaviour with : Agent)

Add the following fields:

The currentNumber and targetNumber fields are the most important here.  Everything else is just for debugging and visualizing.

Our agent will pick a random targetNumber and try to get the currentNumber to our target using our increment and decrement commands.

Next we need to override the CollectState method like this:

Here, we’re returning our two floats for current and target number as the state of our agent.  Notice how this matches up with our 2 state variables on the brain and they’re floats which is why we have it set to continuous state instead of discrete.

For our agent to train, we need to select random target numbers.  To do that, we’ll override the AgentReset() method like this:

The final and most important part we need is the AgentStep() method.  This is where we take in actions (aka input), perform some tasks (respond to the actions), and reward our agent for successful choices.

The first thing you’ll see is our text update.  This is only for debugging / visualizing.  It allows us to see the current #, the target, and the # of times we’ve successfully solved the problem (reached the target number).

Next up is the switch where we look at the action and perform our task.  In this case, we either respond to action 0 by decrementing the current number, or to action 1 by incrementing it.  Any value out of that shouldn’t happen, but if we get one, we just ignore it and return.

Then we move our cube based on the currentNumber (using it for the x offset).  This cube again is only for visualizing, it has no impact on the actual logic or training.

We then check the currentNumber against some known limits.  Since we choose a random number between -1 & 1, if we reach -1.2 or +1.2, we can consider it a failure as it’s definitely going in the wrong direction.  In that case, we set the reward to -1 to denote a failure, then mark done as true so the agent can reset and try again.

Then finally, we check to see if the currentNumber is within 0.01 of the target.  If so, we consider that a match, set the reward to 1.0 for a success, and mark it as done.  We also increment the solved counter for debugging purposes (it’s nice to see how many times it’s been successful).

Here’s the complete script:

Setup The Agent

With the script ready, we need to create a new gameobject and name it “NumberDemoAgent”.

Attach the NumberDemoAgent script to it and assign the brain.

Next create a Text object and place it where you can see it (ideally big in the middle of the screen).

Assign the text object to the NumberDemoAgent.

Create a Cube and a Sphere and assign them to the NumberDemoAgent as well (these will help you see what’s going on, much easier than reading #s).

Testing in Player Mode

Now press play.  You should be able to move the cube left and right with your two hotkeys (remember I went with A & B for the hotkeys).

When you get the box to the sphere, it should increment the solved count and reset.  If you go too far the wrong way it should also reset (remember that 1.2 limit).


Once it works in player mode, select the brain and change the “Brain Type” to “External

Save your scene and build an executable where the scene is the only thing included (with debug mode enabled).

For your output folder, choose the python subdirectory of your ml-agents project (included when you downloaded or cloned the source project).  For example, mine is located here: C:\ml-agents\python.

Remember the name you give it, you’ll need that in just a minute.

Anaconda / Jupyter

Launch an anaconda prompt.

Change directory to the python folder you just built into.  ex. “cd c:\ml-agents\python”

Enter the command “jupyter notebook” (you may need to hit enter a 2nd time btw)

You should be prompted with a web interface shortly after that looks like this:

Change the highlighted parts to match.  On the env_name, don’t just put in “numberdemo”, use the name that you built your executable with.  Buffer_size and batch_size you can copy though (it’s important to note that these #’s were only found by testing/trying, even after getting it working, I still barely understand what’s going on with them).

Once you’re done editing the hyperparameters, run the steps in order.

Start with step 1 & 2.  (the * disappears and a # appears in the [*] when it’s done.

When you run step 3, you should see a window appear for your game (a small window though).  The first time, you’ll probably also get a windows permissions dialog, make sure to allow it.

Once you start step 4… WAIT.. and watch the results come in (first one may take a minute so be patient)

Once it’s saved a couple times, hit the stop button.  Then move on to step 5 and run it.  This will export your training data to a .bytes file in the “python/models/ppo” subfolder.

Copy the .bytes file (again it’ll be named to match your executable name) and place it in your Unity project somewhere.

Select the brain and set the “Brain Type” to “Internal”.

Assign the .bytes file to the “Graph Model” field.

Save and press play!


This is a pretty simple sample, meant to just help get a basic understanding how how this system works.  I’m excited to see where it goes though and build bigger more interesting projects to control game AI and make interesting gameplay / bots.



Unity ML Agents GitHub – https://github.com/Unity-Technologies/ml-agents

HyperParameters Doc – https://github.com/Unity-Technologies/ml-agents/blob/master/docs/best-practices-ppo.md

Machine Learning Playlist –https://www.youtube.com/watch?v=qxicgknzUG8&list=PLB5_EOMkLx_Ub1A4iHoDUx7vg37sVoL-E


Continue reading >

Unity3D Machine Learning – Setting up the environment & Tensorflow for AgentML on Windows 10

By Jason Weimann / October 25, 2017

I’m extremely excited about the new Unity3D Machine Learning functionality that’s being added.  Setting it up was a little painful though, so I wanted to share the steps I followed, with the specific versions that work (I tried a whole lot and nothing else worked).  In this guide, I’ll show you everything you need to get setup and ready to start with the 3D ball example.  There’s also a video version at the end..

Installing the CUDA toolkit

You’ll need to download CUDA 8.0.61 for this to work.

You can view the CUDA download archive here: https://developer.nvidia.com/cuda-toolkit-archive

Select and download CUDA Toolkit 8.0 GA2

Close any open Unity and Visual Studio instances (you’ll have to restart the installer if you don’t do this first)

Run the Installer

Choose Express


Next we need to grab the CUDA Deep Neural Network library aka cuDNN

Visit the CUDNN page herehttps://developer.nvidia.com/cudnn

You’ll need to create an NVIDIA account and log in to download the library.  It’s easy to do and free though.

Once you’re logged in, click the download button.


Choose the download link for v6.0 for CUDA 8.0 – Download cuDNN v6.0 (April 27, 2017), for CUDA 8.0

Copying the CUDNN Files into the Toolkit Folder

Open the cuDNN zip file.

Copy the 3 folders (bin, include, and lib) from the zip file into your CUDA 8.0 folder.

The default folder path you’d copy into is C:\Program Files\NVIDIA GPU Computing Toolkit\cuda\v8.0

Copy these folders

Into Here


Environment Variables & Path

Now you need to add an environment variable and two path entries.

Open the environment variable dialog (hit the windows key and start typing envir…. and it’ll auto popup for you)

Click the Environment Variables Button

Click the New button to add a new System Variable

Set the Variable Name to CUDA_HOME

Set the Value to C:\Program Files\NVIDIA GPU Computing Toolkit\cuda\v8.0

Editing the Path

Find the Path in the Environment Variables Dialog

Make sure you select the System variables version, not the user variables!

Click Edit

Add the following two folders to the path.

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\lib\x64

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\extras\CUPTI\libx64

Click Ok a couple times to close out the dialogs.


Anaconda Setup

Next, we need to install Anaconda to configure our python environment.

Visit the download page here: https://www.anaconda.com/download/

Download the 3.6 version (I went with the 64 bit installer, not sure if it matters but I’d go with that one).

Run the Anaconda Installer and choose the default options all the way through.


After the installation completes, open the Anaconda Prompt

Creating the Conda Enviroment

Next, we need to create an environment with python 3.5.2.

Run the conda create command in the prompt like this:

conda create -n tensorflow-gpu python=3.5.2

Next, activate the newly created environment with this command:

activate tensorflow-gpu

And finally, install tensorflow with this command

pip install tensorflow-gpu


Once the installation completes, you can test that it was successful by launching python (still from that anaconda prompt) by typing:


Then use the command:

import tensorflow as tf


Downloading the Sample Project

To try out the ML agents, you’ll want to download the sample project from the GitHub page here: https://github.com/Unity-Technologies/ml-agents

You can download the zip or use GIT and clone the repository.

Next, open another anaconda prompt as an administrator.

Change directory into the ‘python’ subfolder or the location you cloned or unzipped the project into.

For example, my folder is: C:\Git\ml-agents\python because I cloned the repository into my c:\git folder.

Fixing Html5lib

Next, type the following command: conda install –force html5lib 

Now type: pip install .

Make sure you include that period, it’s part of the command.

Next Steps

If there are no errors, you’re good to go and ready to start setting up your Unity project with tensorflow and machine learning!

Next, you’ll want to build the Unity Environment.  The steps for this are very clearly laid out here so I won’t repeat them: https://github.com/Unity-Technologies/ml-agents/blob/master/docs/Getting-Started-with-Balance-Ball.md

One issue I ran into though was the ENABLE_TENSORFLOW define being cleared out after I installed the tensorflowsharp library.  When this happened, the “Internal” option disappeared.  Simply re-add it and hit play so it re-compiles, then the internal option should re-appear.

Special Thanks

First I wanted to say thanks to the guys at Unity for building this all out.  I’m excited to start integrating machine learning into projects for my AI.

I also wanted to thank Nitish Mutha for this awesome blog post that got me 90% of the way through this setup.



Continue reading >
1 2 3 14
Page 1 of 14