this vs gameObject in Unity

A common cause of confusion is the difference between this and gameObject in Unity code. this is the current component, so for example if inside Player.cs then Destroy(this) would destroy the Player component, but not the game object in the scene of hierarchy. gameObject is the current game object. So in the example of a Player game object, with a Player.cs component script added then Destroy(gameObject) would delete the entire game object from the scene and hierarchy, not just the Player component. I hope this helps

Unity Scriptable Objects for shared state

Unity Scriptable Objects for shared state

Unity has a rarely used feature known as Scriptable Objects. These are essentially very light weight components, allowing one to edit them in the editor, set pre-defined states, and place them in components as required. Instead of inheriting from MonoBehavior, inherit from ScriptableObjects. ScriptableObjects do not have all of the same states that Monobehaviors do, they can be validated, but do not have the Update/Start/Etc methods required by MonoBehavior. Materials are actually Scriptable Objects, along with several other components in the Unity Architecture. One of the simplest uses of Scriptable Objects is that of a shared state. Let’s say that you have a score that many different objects need to know in the game. There are basically 3 ways that you can do that: use a static object or Singleton, use a single component that keeps the state, or use scriptable objects. Static Interfaces are not well supported in Unity. If one changes the code, Unity cannot hot swap the state. They can change the entire system, but it can sometimes be unclear what in the system can change things. The also suffer from a difficulty in testing individual components. For instance, what happens if you have a score board, […]

Read More

Creating Unreal Engine UI with UMG and C++

Creating Unreal Engine UI with UMG and C++

In this post I’m going to assume you’re already familiar with the Blueprint tools for UMG (Unreals UI framework). These are definitely the best way to go about designing you interfaces. Who wants to be doing that in C++? But there are good reasons to be using C++ for the logic driving your UI: version-ability, performance or just preference. How can we seamlessly bind our clean, performant C++ to the beautiful UI design created by the editor? This post outlines the tips and tricks I’ve learnt. Basic setup The first thing I suggest you do: make a C++ parent class, it can be empty to begin with but you’ll need to derive from UUserWidget. Then we can go along and re-parent the Blueprint widget to this C++ class. If this seems familiar, good. It’s very common to setup a Blueprint child with a C++ parent. It allows us to put a designer friendly skin on a C++ core. That’s what we’re doing here after all, just as we might with an Actor or Pawn. Creating a Blueprint Widget from C++ You may not want to load you widgets from C++. This is a task commonly accomplished in the Level Blueprint. […]

Read More

Making a Unity Screen Saver

Making a Unity Screen Saver

For the last few months, I have been fascinated with Elon Musk’s Tesla Roadster that he launched in to space. I was fascinated so much I even created a website, http://www.whereisroadster.com, which tracks said roadster in it’s travels through space. I watched the video that SpaceX released showing video of the car traveling in Earth orbit for several hours. In that process, I decided that I wanted to make a simulation of what the Roadster would look like, and in the end I decided I wanted to make a screen saver that would show where the Tesla Roadster is in space at any one time, and show it to the user. In the end, I developed a simulation in Unity that looks something like this: This simulation captured my attention, but I wanted to figure out how to make it in to a screen saver. In the end I ended up releasing this to the Unity Asset Store, but I wanted to give you at least the basics of what is required. The first thing is that your application must be able to run completely on it’s own. This means no inputs, setting up the screen resolution, etc. Secondly, add […]

Read More

10 Ways For Quicker Animation Renders

10 Ways For Quicker Animation Renders

Waiting for Blender to render something can be a real pain and if you are doing an animation the time is only compounded! There are a number of things you can do to speed up rendering animations and we’ll go through them all in this article, they’ll apply equally to singles frame renders too. The benefits of some of the optimisations can be reduced a lot for simple scenes, I mean what’s a 2 second saving…  But wait at 30 frames per second, that’s a minute of rendering time saved for every second of final output! Savings can compound significantly when animating Save Before You Render Good advice in general! Rendering is one of the main causes of crashing in Blender, and rendering an animation only compounds that issue. Save you work before you hit the render button! Nothing worse than having to reconfigure your rendering because you forgot to save. Render Often Test your work often to make sure what you think is happening is what really is happening when it comes to your rendering. Contrary to the time saving advice below, do render at final resolutionand settings occasionally too, I have had horrible artifacts appear that were masked […]

Read More

3 Tips To Get Your Game Ranking in Google Play Store

3 Tips To Get Your Game Ranking in Google Play Store

Ever wondered how to get your game to rank? Complete Unity Developer student, Rafael, shares his experience of taking his first game from nowhere to third in the Google Play store listing (for the term “ragdoll physics”).  Rafael’s Story My name is Rafael Rivera, I’m a 38 year old advertisement bachelor from Rio de Janeiro, Brazil and I’m an Indie Game developer. Since I can remember, I was always playing video games. I’m the type of gamer that enjoys every kind of game – from 8-bits to flash games, mobile, Xbox or PC. If it’s fun then I will play it! I always wanted to work with games, but it was not an easy option back then… before the internet. Yeah, I’m from that time. Since I decided to start my Gamedev journey with Unity, about eight months ago, I searched online for courses and found Udemy. I clicked on their ‘best-rated Unity courses’ and found “Complete Unity Developer – Learn To Code By Making Games” with instructor Ben Tristem and team. I learnt everything I needed for my first game: animations, level managers, buttons, sounds, physics, coding in C# and more. Ben Tristem is a great teacher. The course made […]

Read More

Installing Multiple Versions Of Blender On Windows

Installing Multiple Versions Of Blender On Windows

Installing Multiple Versions Of Blender On Windows A new version of Blender has come out, so should you install it and get all the new shiny features and bug fixes? Not so fast! There’s a better way of doing this, so read this article and save yourself a potential nightmare. I let everything else update, why not Blender? Have you noticed that Blender doesn’t automatically update, there’s a reason for that. Have you installed Blender through Steam or Ninite? I would recommend you do not. So what are the potential downsides of installing the latest version or having it auto update through software like Steam or Ninite? Well without taking control of this process they can vary from irritating to completely devastating. They can include: Losing your custom Blender profile Losing installed add-ons and their configurations. Project not working as they did before. Projects being completely broken! That is why Blender doesn’t automatically update by itself. So is there a solution? Yes, you can manage your Blender Installs so you can have multiple versions of it running on a single computer. . There are 2 ways to achieve this goal. Manage the install process itself. Run Blender in a portable […]

Read More

Student Game: Super-Gravity Switch Battle

Student Game: Super-Gravity Switch Battle

Always brightens our day to see what you folks create while taking our courses. Today we’re sharing Lukas’s story, about working as part of an aspiring indie GameDev start-up in South America and releasing their first game. What’s your background? My name is Lukas, I’m a System Engineer and Mathematician and I’m the programmer in the MIKRO team.  MIKRO is a nascent indie GameDev company in Colombia, South America. As well as myself, there’s Javier (our 3D modeller) and we have some other people who take part, depending on the size of each game. How did you end up on a Udemy course? My experience as programmer is good, so I decided to make games in Unity and C#. I knew the engine from the first versions, but hadn’t used it for a couple of years. To get quickly up to speed,  I decided to take some courses and looking on the internet I found GameDev.TV on Udemy.  In MIKRO we started with a game called Super – Gravity Switch Battle, which we wanted to be the opening chapter for a possible sequel. This first adventure is a basic platform where our little potbellied hero jumps, changes gravity and takes powers to […]

Read More

Rigging Quickly In Blender

Rigging Quickly In Blender

Rigging Quickly and Precisely With Naming And The Armature Modifier Getting your naming right can save you a lot of stress and time, and rigging is no different. In this quick tip article, we’ll take a look at how you can be really lazy and use a technique called automatic weighting. This is usually not ideal (as it lacks control for anything but the simplest models), so we’ll take a closer look at how we can use the armature modifier to our advantage. Automatic Weight OK, so I say it is lazy but it might actually save you a load of time and be good enough during prototyping – just don’t expect it to work well with more complex models! You will require two things: A model and an armature. Save your work so you can start over if this doesn’t work out Make sure you are in Object mode Select all the mesh objects you want controlled by you armature Select the armature last, making it the active object. -notice how all the mesh has a darker orange outline, whilst the armature has a lighter orange. That indicates it is the active mesh object. Either use the Object menu, […]

Read More

Triggering World Animations In Unity Timeline To Tell Stories

Triggering World Animations In Unity Timeline To Tell Stories

How do AAA games make their worlds feel alive and interesting, even if all the player is doing is walking down the street? They consider their worlds as living entities, not just static backdrops. One way they do this is by using movement within their game world to tell a story.   Let’s look at a simple, specific example… Here is a game scene from our RPG that we’ve been developing. The player is progressing along their path, heading towards the next steps of the quest we’ve created for them. In our game, like most RPGs, we’re using combat as a primary system of challenge and interest… but of course we don’t want to have one, long, continuous combat sequence. In this instance, what are our options for communicating story to the player? Well, we can have the player bump into an NPC and deliver some dialogue. That is usually the most to-the-point way of getting story across. For example: Crazy Bill: Quick, the town is under attack, the villagers need help. Player: Rightio Bill, I’ll get right on that. Or we can pop up a dialogue box on the screen saying something to the effect of: “The town is […]

Read More