Creating a hello world app in Unity

My adventure getting started in Unity

First you need to get Unity Hub, create a personal account for free and then go ahead and download Unity. Once you’re all set with your license you can easily download unity through the website or the hub

Unity Hub Download Setup Page

Your license will automatically be added and Unity Visual Studio will download approximately 1.3 gb of data to your disk. Through the Hub they have lot’s of different features — along with install base.

You can checkout the tutorials, learn how to create specific projects and also start and create your own project.

Learn Section on the Unity App with Projects and Tutorial

Now that Unity is installed I’ll go ahead and open it and create a new project we’ll call it “Hello My New World” since Unity has an option to code in Javascript, I’ll be working with Javascript and hold on C# for now…let’s figure out how to create that code. It’s actually taking quite a bit to install so I’m going to hold off for a minute. And start with a quick tangent. Let’s find a cool rails gem that changes colors while loading a script maybe on rails db:seed…wow this rails stuff is also taking a while to set up, but it looks like it installed faster than Unity :) I’m going to CD into my “loading-genie” project and I’m going to create a really large seed file that creates a new model each time. So let’s generate a resource called largeDevil

rails g resource large_devils 

I added a string and an integer to the large_devils area

class CreateLargeDevils < ActiveRecord::Migration[6.0]
def change
create_table :large_devils do |t|
t.string :name
t.integer :data

and I migrated the data

Now I’m going to seed 100,000 of these large devils with a random number also I’m going to faker a name for each of these, which will take even more time, since it has to pull from the API

Added the faker gem

gem ‘faker’

100000.times do 
LargeDevil.create(name:, data: rand(1..100000))

Making 100000 large devils

Actually I’m just going to make 10,000 so I an see how it ends

10000.times do 
puts ("creating large devil")
LargeDevil.create(name:, data: rand(1..100000))
Current Procedure

Looks like this when creating the large devil. But let’s try this gem by janlelis called whirly

gem install whirly
gem 'whirly', '~> 0.2.6'

Also installing a gem called paint that whirly recommends to make the terminal text look colorful

gem 'paint'

and it looks like we need to wrap this inside a method while the block executes

10000.times do 
Whirly.start do
puts ("creating large devil")
LargeDevil.create(name:, data: rand(1..100000))
sleep 5

Cool, now it looks like every 5 seconds emojis cycle through each other to indicate a loading bar

emoji loading animations

by default the whirly is emoji’s, we can configure it to display dots instead

Whirly.configure spinner: "dots"

and let’s set sleep to 10 seconds and it works! And I’m happy with the results

loading animations

and Unity finally finished installing. so let’s create a new project and we’ll make it 3D

I have no clue what I’m doing here — but I’ll give it a shot!

doing some more install things, so i’ll continue to create my ruby file…or not, it looks like it’s finished.

Now that Unity window is open, I’m going to create a new C# script, I named it helloWorld and opened it up in Sublime

To make sure that the script is connected to Unity we need to add a console.log, similar to javascript but in Csharp its called Debug.Log

void Start()
Debug.Log("Hello World");

Now we need to attach the script to an Object, so we’ll create an empty object to attach the script too

and we’ll rename the empty object to “Debug” and we’ll drag and add the script to the object. Now we’re officially connected to the object and when the scene runs it outputs hello world into our text!

And now when the scene runs, the cSharp file will be executed and we’ll see “hello world” outputting in our console!

Designer, Developer, Musician.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store