Content that is all about development in Unity 3D and programming! Find examples of code often written in C# along with tutorials.

Ascending to the Next Level – RPG Dev Weekly #2

(You can check out the prior week of RPG development here) Well, so far not so great for getting weekly posts on RPG development! It's probably better for me to aim to do these periodically and summarize the last week or so of work. Fewer commitments that way and it's a bit more realistic for me to achieve. With that said, let's dive into it! Entity Filtering in an RPG Our RPG has had some notion of entity filtering for a long time, but to understand the current state of filtering, it's important to understand the two major sets of entities and components we have: Game Objects + Behaviors: Everything in our RPG game world is represented as a "game object" and the properties/capabilities are captured by components called "behaviors" Definitions + Generator Components: The content for our game is…

0 Comments

Unity3D And How to Master Stitching Using Autofac

In Unity3D, the scripts we write and attach to GameObjects inherit from a base class called MonoBehaviour (and yes, that says Behaviour with a U in it, not the American spelling like Behavior... Just a heads up). MonoBehaviour instances can be attached to GameObjects in code by calling the AddComponent method, which takes a type parameter or type argument, and returns the new instance of the attached MonoBehaviour that it creates. This API usage means that: We cannot attach existing instances of a MonoBehaviour to a GameObject Unity3D takes care of instantiating MonoBehaviours for us (thanks Unity!) ... We can't pass parameters into the constructor of a MonoBehaviour because Unity3D only handles parameterless constructors (boo Unity!) So what's the problem with that? It kind of goes against some design patterns I'm a big fan of, where you pass your object's…

1 Comment

Using Autofac With Unity3D

Why Consider Using Autofac With Unity3D? I think using a dependency injection framework is really valuable when you're building a complex application, and in my opinion, a game built in Unity is a great example of this. Using Autofac with Unity3D doesn't need to be a special case. I wrote a primer for using Autofac, and in it I discuss reasons why it's valuable and some of the reasons you'd consider switching to using a dependency container framework. Now it doesn't need to be Autofac, but I love the API and the usability, so that's my weapon of choice. Building a game can result in many complex systems working together. Not only that, if you intend to build many games it's a great opportunity to refactor code into different libraries for re-usability. If we're practicing writing good code using constructor…

2 Comments

Unity3D and .NET 4.x Framework

Unity3D Default .NET Framework I recently wrote that I wanted to start writing more Unity3D articles because I'm starting to pick up more Unity3D hobby work. It felt like a good opportunity to share some of my learnings so that anyone searching across the web might stumble upon this and get answers to the same problems I had. Unity3D as of 2018.1.1f1 (which is the version I'm currently using), still defaults to using .NET 3.5 as the framework version. Nothing wrong with that either. I'm sure there are reasons that they have for staying at that version, probably because of Mono and cross platform reasons if I were to guess, so I'm not complaining. For reference, this setting in Unity3D is referred to as "Scripting Runtime Version". So if you're googling more about this later, that's what Unity calls it.…

0 Comments

API: Top-Down? Bottom-Up? Somewhere in the Middle?

A Quick Brain-Dump on API Desgin I'll keep this one pretty brief as I haven't totally nailed down my thoughts on this. I still thought it was worth a quick little post: When you're creating a brand new API to expose some functionality of a system, should you design it with a strong focus on how the internals work? Should you ignore how internals work and make it as easy to consume as possible? Or is there an obvious balance? I find myself trying to answer this question without ever explicitly asking it. Any time I'm looking to extend or connect systems, this is likely to come up. Most Recently... Most recently I started trying to look at creating an API over AMQP to connect my game back-end to a Unity 3D front-end. I had been developing the back-end for…

0 Comments

Multiple C# Projects In Your Unity 3D Solution

Problem: Visual Studio and Unity Aren't Playing Nice! UPDATE: This is for older setups with Visual Studio and Unity. You may want to look at Assembly Definitions. I just started poking around in Unity 4.6 and I've been having a blast. I've made it to the point where I want to actually start hammering out some code, but I came across a bit of a problem: I want to start leveraging other projects I've written in my Unity solution while I'm in Visual Studio, and things are blowing up. So, what gives? Okay, so let me start by explaining why I want to do this. I understand that if I'm making a simple game, I should have no problem breaking out my unity scripts into sub folders and organizing them to be nice and pretty. The problem I'm encountering is that I…

11 Comments

End of content

No more pages to load