• Home
  • Contact
  • Careers
  • Socialize With Us:
  • Send us Mail
  • Follow us on Twitter
  • Join our Facebook Group
  • /
  • Linkedin
  • /
  • Vimeo Videos
  • /
  • Youtube
  • /
  • RSS Feed
  • Search Site

  • About UsAwards & Bio
  • PortfolioOur Latest Work
  • TrainingTips & Tutorials
  • BlogGreat Articles

You are here: Home / 2013

Archive for year: 2013

Unity3D Unit Testing 2: Unity Test Tools

Category: Quick Tips, RMC News     |     Tags: Debugging, Testing, Unity3D

About RMC & Unity3D

Rivello Multimedia Consulting (RMC) provides consulting services for applications and games. RMC specializes in Unity3D development (see our work here). Please contact us today with any questions, comments, and project quotes.

As always, RivelloMultimediaConsulting.com/unity/ will be the central location for deep articles and tutorials, Facebook.com/RivelloMultimediaConsulting (like us!) will engage the growing RMC+Unity community, and for the latest opinions and cool links follow me at Twitter.com/srivello.

Intro To Unit Testing

To get the full background on what exactly are unit tests and more, checkout my “Unity3D Unit Testing 1” article first. It covers the basics as well as the historical challenges of testing within Unity. There I also cover the theory of TDD.

Unity Test Tools

In December, 2013 Unity Technologies released Unity Test Tools (UTT). While there had been several 3rd party options to attempting testing, now we have the official solution.

Figure 1. Unity Test Tools Released

Figure 1. Unity Test Tools Released

As Unity Technologies previously announced, they have been using testing internally on the core Unity3D codebase for a couple years. Lessons learned there helped to shape the free, newly released Asset Store Item Unity Test Tools.

The UTT package comes with 2 major areas of functionality. We cover them here.

1. Assertion Component

The assertion component is able to monitor the state of gameobjects while in playmode and pause the game if the condition is met. The primary use is debugging, where you can make the game stop in the exact frame the condition is met, thus enabling you to see the entire picture of when it occurs.

2. Integration Test

In order for you to test the integration between components, objects and assets, you need a higher level of tests and for this Unity has made the Integration Test Framework. Integration tests are also the easiest way of starting to write automation tests on a game in development, since they don’t have requirements on the architecture of the code.

This is obviously very powerful. Its early, but it is not yet clear to me how to utilize this in my project workflow. But I’ll figure it out soon. However, the following feature is perfect for me.

3. Unit Test

NUnit-Net-0

The lowest and most efficient level to do automation is at the unit level. Unity decided to use nUnit (nUnit.org) as the basis for the unit test framework, which is a well known framework for those already writing unit tests. In development, a ‘unit of work’ is a single logical functional use case in the system that can be invoked by some public interface (in most cases). A unit of work can span a single method, a whole class or multiple classes working together to achieve one single logical purpose that can be verified.

A unit test is an automated piece of code that invokes a unit of work in the system and then checks a single assumption about the behavior of that unit of work. Good unit testing is an art and a science and there is TONS of material online about it.

A good unit test is:

  •  Fully automated
  •  Consistently returns the same result
  •  Tests a single logical concept in the system

The Unity Test Tools

The free, newly released Asset Store Item Unity Test Tools, include the core testing libraries, examples of all 3 of the above types of tests, and documentation. If you find the documentation to be dry and obtuse (*hint*), then you are in luck. Checkout my video here. It cover only Unit Testing. The full source-code shown in the video is available for you too (See ‘Member Resources’ Below).

[tubepress video=”82440469″]

Member Resources

[private_Free member]Enjoy this members-only content!

  • Download My Unity Testing Tools Demo Project

[/private_Free member]

Unity3D MVCS Architectures: StrangeIoC

Category: Quick Tips, Screencast Tutorials, Source Code, Standards & Best Practices     |     Tags: API, C#, Design Patterns, MVCS Architecture, Unity3D

Unity3D is a powerful suite of tools (Project IDE, Code IDE, run-time) for game development. In Unity3D Game Architectures I present six different techniques for setting up your game. Depending on the size and maturity of your team, you are probably doing some form of those. I recommend checking that article out first, then read below.

The Strange IoC Template

I consulted for years with PureMVC. From that, a spiritual successor with dependency injection was born as Robotlegs (RL). RL became my default choice for many projects. I’ve used both within the last year. Depending on client preferences. To share with the world a simple, consistent, starter project I created and shared a Template for PureMVC and a Template for RobotLegs. I continue that same ‘template idea’ for the article here. There is no popular version of those for Unity, until now. StrangeIoC is a fantastic, free implementation of Robotlegs plus Signals. Signals for C# comes from separate project available in other programming languages which replaces the standard use of Events dispatched often through a central Event Bus. The benefits of Signals are well known, but not everyone prefers them. I do prefer them, so my template exclusively includes Signals instead of Events. You can do either or both in StrangeIoC. You can play the unshockingly unsexy demo here, and then read about the internals here in the article, with full source-code (See ‘Members Resources’ below).

Figure 1. Click Image To Play “StrangeIoC Template”

Table of Contents

  1. What is StrangeIoC?
  2. My StrangeIoC Template
  3. My PropertyChangeSignal Extension for StrangeIoC

1. What is StrangeIoC?

Strange is a super-lightweight and highly extensible Inversion-of-Control (IoC) framework, written specifically for C# and Unity. The StrangeIoC team has validated Strange on web, standalone, and iOS (currently testing on Android).

Figure 2.

Figure 2. StrangeIOC Diagram

StrangeIoC includes;

  • IoC through Dependency Injection
  • Choice of Signals and/or Events (with 2 styles of EventBus)
  • MonoBehaviour mediation
  • Optional MVCS (Model/View/Controller/Service) structure
  • Multiple contexts (parts of your app can ‘care for themselves’ if desired)
  • And much more…

Pros:

  • Public, Community-driven, well-documented. (e.g. You can hire/contract a new developer who arrives with this skill on day 1)
  • Decoupled, testable, & D.R.Y.
  • Scales-up well for large teams, large projects

Cons:

  • Slower to setup (but faster to add last-minute changes)
  • Steeper learning curve, especially for junior developers
  • Demands discipline/know-how from your team to put logic in its proper place (but removes the ‘where should we put that code?’ decision process)

2. My StrangeIoC Template

While the MVCS setup for Strange is optional, it is my preference. To understand the template. It is absolutely necessary to understand the fundamentals before digging into my source-code. For those familiar with MVCS, the learning curve is very quick. For those familiar with Robotlegs, you are in luck, the creators of Strange have a special “Introduction to Strange for Robotlegs Users“. I haven’t read that, but in general the Strange documentation is very well written, light (fun?), and relevant.

Diagram
Figure 3. StrangeIOC Template Diagram
  Diagram
Figure 4. StrangeIOC Template Console

Pros:

  • Together with this article, I hope it the template is a GREAT way for you to learn StrangeIoC
  • Coming from PureMVC or Robotlegs? (Download and compare the similar templates for PureMVC and RobotLegs)
  • Intuitive for beginners, e.g. “Bowling-pin code goes on the bowling-pin”

Cons:

  • My style is just ONE way to use StrangeIOC. Every team should learn their own style.
  • It is a very, very simple example (this is also ‘pro’)
  • My Unity3D/C# coding standards are NOT the official Microsoft way. Ha!

Video

Part of the Unity With Cocktails video training series,  this video covers the “My StrangeIoC Template” section of this article. While the purpose and definition of MVCS is not explicitly included, there is some related tidbits in there. Also we see the ‘5 major steps’ in setting up StrangeIoC. 

[tubepress video=”82322606″]

More Info on MVCS

For the uninitiated to MVCS, let’s dig in! There is tons of info online so I’ll keep this section light (fun?). The basic idea is that you purposefully separate you coding stuff (‘coding concerns’) into 4 distinct areas which are discussed below. If the app doesn’t talk to any backend servers, you don’t need the service. So you often see the same basic structure described as MVC. But we’ll use MVCS just to be comprehensive.  So, looking at the diagram (Figure 3.) we can see some major areas of the application. The layout of this diagram mimic like the StrangeIOC Official Diagram above (Figure 2.). MVCS (for laymans)

  • Model – “I hold ALL of the data, ha ha ha.”
  • View – “Hey, look at this” (graphics, gui, sound) and “Oh, you clicked the mouse” (input), “Either way I’ll tell the controller about it”.
  • Controller – “Hey Model (or Service), someone clicked a button so do X or Y”, or “Service, you loaded? Ok, I’ll tell the model”, or “Thanks Model for the updated data, I’ll tell the view to show that”.
  • Services – “Welcome everyone, I’m going to just load stuff from offline files and online servers and tell the controller”.

Sample Orchestration: Clicking the Load Button Orchestration is my term for one ‘trip’ through some part of the MVCS for a specific purpose. Here we go from a button click to data storage and back to update the screen. We’ll step through the numbers from the console output (see Figure 4.). From View To Model Starting with the view (1), the user clicks the button in the UI, and the UI holding the button tells its paired mediator about it. The mediator sends a message (dispatches a signal which is mapped already to a command) and a command is executed (2). The command knows what needs to be done (a.k.a. business logic) and in this case that means to tell the service to load data from a local file (3). When the service finishes loading (4), its sends a message (dispatches a signal which is mapped already to a command), and a command is executed (5) which knows to put the freshly loaded data from the service into the model (6). From Model to View Continuing on, the model updates its internal data storage and then sends a message which anyone who cares can listen to. In this case the mediator is listening (7) and knows to update the UI.

Its important to note that while data started in the service and was passed around a bit before finally landing in the model, that – its the model that STORES the data as a class variable. The other data is temporary variables and they go away quickly. Its like wires that hold electricity temporarily but really only the battery STORES the electricity.

That sounds like a lot of steps. Yes it is. And for each ‘button’ or feature you add to the app you do something similar. However, very early in the learning curve you will both a) get fast at adding new features and b) see the benefits of mvcs.


3. PropertyChangeSignal

To aid my work with StrangeIoC, I created a few classes that function together to reduce the workload. I call this the PropertyChangeSignal. It helps to streamline your workflow in data-heavy applications where you need signals for data events such as REQUEST, CLEAR, UPDATE, and notify upon UPDATED.

Update: The complete article “Unity3D MVCS Architectures: StrangeIoC 2 PropertyChangeSignal” is ready. Check it out!


What’s next?

Want to learn something more basic? Or are you ready for more advanced topics about UnityEngine and C#? Checkout my “Unity With Cocktails” HD Tutorial Video Series on C# and Unity.

Member Resources

Members can access the full source-code for this post. Membership is free.

[private_Free member]Enjoy this members-only content!

  • Download Source-code ( StrangeIoCTemplate )

[/private_Free member]

What are your thoughts?

Do you prefer an alternative to the suggestions above? Or do you have an additional recommendation? Please comment below. [polldaddy poll=7611650]

Unity3D Game Architectures

Category: Quick Tips, Screencast Tutorials, Source Code, Standards & Best Practices     |     Tags: API, C#, Design Patterns, MVCS Architecture, Unity3D

Unity is a powerful suite of tools (Project IDE, Code IDE, run-time) for game development.

I have explored many architectural approaches to game projects. Architecture is a hot topic in Unity — especially related to scaling up to larger Unity game projects.

My architectural background includes many frameworks. Highlights include heavy usage of Robotlegs (I event contributed to the project and drew the official diagram), PureMVC (I was the technical editor for the O’Reilly book on it), and PushButton (I published related articles for Adobe). I also presented and taught about the three at conferences and weekend workshops. Of these, only PushButton is a game-specific architecture, but all can be applied to games.

What are the qualities of a good gaming architecture? Most architects applaud solutions which are flexible, readable, D.R.Y., testable, orthogonal, and “refactorable” (at an acceptable cost). I will discuss the philosophy of design in a future post, but for now I simply list the major pros and cons of each approach.

Unity3D Bowling

What are the qualities of a good gaming architecture? Solutions which are flexible, readable, D.R.Y., testable, orthogonal, and “refactorable” (at an acceptable cost). I will discuss the philosophy of design in a future post, but for now, I simply list the major pros and cons of each approach.

Figure 1. Click Image To Play “Bowling”

I review some common approaches and a few novel ones. For each, there are images, details, and an example with full source-code (See ‘Members Resources’ below).

Table of Contents

  1. No Manager
  2. EmptyGO
  3. SimpleGameManager
  4. uMom
  5. Custom MVCS
  6. StrangeIoC

1. No Manager

This is your most basic approach. First-time Unity-developers often start with this technique. Here you put bowling ball code on the bowling ball, bowling pin code on the bowling pin, and ‘game win vs game loss’ code on something random, like the bowling ball too.

Because Unity’s ‘component-based’ approach is so intrinsically awesome (reusable code ‘components’ sit on 1 or more GameObject ‘entities’) you can indeed get very far using this approach. If you are coming from a hierarchical approach to gaming, learning the component-approach can be a challenge and your first projects may be of this ‘No Manager’ approach here in #1 or soon evolve to the ‘EmptyGO’ approach we see below in #2.

Diagram
Diagram
Diagram
Hierarchy

Type: Component-based

Pros:

  • There are MANY free, useful tutorials created using this “No Manager” approach. So its easier to learn the basics of Unity this way.
  • Flexibility for prototyping
  • Intuitive for beginners, e.g. “Bowling-pin code goes on the bowling-pin”

Cons:

  • It is the very definition of spaghetti code
  • Very low scalability for teams (of 3 or more)
  • Very low scalability for projects of intermediate or high complexity.

2. EmptyGO

This is a slight evolution beyond #1 above. Still you put bowling ball code on the bowling ball, bowling pin code on the bowling pin, BUT you try now to put all the rest of code which has no visual representation in the world onto an invisible or ’empty’ GameObject (GO). Hence the name ‘EmptyGO’.

This technique still has alot of drawbacks, but at least we begin to see game logic more centralized (on that EmptyGO). This aids readability for newbies working on your project, or for you after you return to an older project after a long time. You don’t need to hunt around everywhere to find your core code — most sits there on the EmptyGO.

Diagram
Diagram
Diagram
Hierarchy

Type: Component-based

Pros:

  • More readable (than #1 above)
  • Good mix of flexibility for prototyping (yet not AS much spaghetti code as #1 above)
  • Intuitive for beginners, e.g. “Bowling-pin code goes on the bowling-pin”

Cons:

  • Less testable
  • Less refactorable (since less code is likely to be properly abstracted, decoupled, and reusable when compared to 3,4,5,6 below)
  • Communication and referencing between GameObjects is likely too brittle (e.g. using GameObject.Find() or inspector target references)

3. SimpleGameManager

Probably the most mature technique which is in WIDE usage within the free tutorials and sample projects you find in the community is something like my SimpleGameManager technique. Imagine the ‘EmptyGO’ from #2 above, but now its a persistent (between scenes) Singleton.

Code still exists directly the GameObjects in the world, but whenever possible it calls centralized code [e.g. ‘SimpleGameManager.Instance.playSound (“GunShot”); ] Its a good approach and an appropriate (simple) solution for many small projects.

Diagram
Diagram
Diagram
Hierarchy

Type: Component-based w/ Manager

Pros:

  • Ultra-fast setup (but with minimal functionality). Its more of a racetrack — where YOU must supply the race-cars.
  • Persists between scenes, and if its not created it will create itself as soon as it is referenced (because its a Singleton).
  • Ideal for prototypes (but thus not scalable)

Cons:

  • Its not plug-and-play per say. The current workflow is to import the package and EDIT the core class, rather than use/extend.
  • Not D.R.Y.
  • Less testable. Much of your code STILL sits around on various GameObjects (like in 1 & 2 above).

Sample Game

  • Coins And Platforms (Play The Game, View Video, Download Full Source-Code)

4. uMOM

My (unreleased) uMOM Asset Store project arose from a problem inherent in Unity. There is no default Main.main() type ‘hook’ to centralize the entry into your run-time and no default way for UI and code to persist from scene to scene. This was the genesis of the Unity Manager of Managers (uMOM), pronounced as /you-mom/. You can read more at the uMOM Dev Diary and see the status of the project (it has some issues). Here is a short summary of purpose and benefits;

The uMOM package allows developers to add one or many reusable, custom manager classes to the project. Each ‘start’ automatically, have a predictable life-cycle (reset, add, update, remove), optionally receive ‘update()’ calls, optionally run during edit mode, and optionally persist between scenes. Managers operate as singletons and can easily address each other to collaborate.

Types of uMOM Managers: Really anything is possible, but here is the short list of use cases I will address first. Use some of mine or none of mine – then create your own. Most any existing manager class you have can easily be converted for compatibility here. 

  • uEventManager -Streamline messaging between classes. Replace the need for Unity’s clunky ‘SendMessage’ and instead dispatch strongly typed objects. (The uEventManager will also be available separately).
  • Store references to audio clips (drag-n-drop) and control audio playback via C# from one place.
  • GUIManager – Layout UI which optionally persists between scenes. Centralize the controls to handle clicks, etc…
  • PoolManager – Optimize your run-time performance by persisting GameObject or prefab instances in RAM and displaying them as needed.
  • LevelManager – Queue up levels and perform transitions (e.g. fade-in-out) between them.
  • GameManager – While other managers are not project specific, this one likely is. Here you manage the core game mechanics, how the user wins and loses, store the score, etc…
  • SaveManager: Takes care of saving and loading user preferences and achievements.
  • MenuManager: Controls all menus, managing their animations, their contents, and their behaviors. Perhaps it heavily uses the GUIManager for layout.
  • Much, much, more…
Diagram
Diagram
Diagram
Hierarchy

Type: Component-based w/ Manager

Note: The images and source-code for this architecture are not yet available.

Pros:

  • Reuse code between projects. That is probably its greatest strength. Ultra fast to setup with mucho out-of-the-box functionality. Nice GUI!
  • Have global access (also a con) to managers which are decoupled by discipline (GUIManager, LevelManager, AudioManager, etc…) each with a common interface and life-cycle.
  • Scalable to large teams such as 4-10 developers (but may require more planning upfront and dedicated team members creating the managers vs. those using the managers)

Cons:

  • The benefits of MVCS separation are not implicit ( but are possible ).
  • More scalable to complex games than 1,2,3 above, but far less than 6 below.
  • Still in alpha with bugs which prevent production-readiness.

5. uMVCS

For non-game projects, such as data-driven applications, there is a clear favorite in architectures; the Model-View-Controller-Service (MVCS or MVC). For the uninitiated, its where you separate your code into 4 areas; the data, the user interface, the core functionality, and any calls to/from backend-servers. It seems like OVERKILL at first, but once one is well-practiced he/she can drop in a template (e.g. Unity Package) and in 5 minutes  be ready to rock.

The “uMVCS” is a ultra-light framework I created myself. Its one of many, many setups for MVCS. I created recently, from scratch in just few hours for ACADEMIC PURPOSES ONLY. It is not complete and scalable like other implementations, but if you have never touched MVCS before, its a great way to learn.

Diagram
Diagram
Diagram
Hierarchy

Type: MVCS

Note: The images and source-code for this architecture are not yet available.

Pros:

  • Great for learning
  • Uses a custom event-dispatcher implementation of the observer pattern for decoupled communication from any scope to any scope.
  • Heavy use of Singletons (also a con) allows access to the ‘architecture’ from any coding scope.

Cons:

  • Purposefully incomplete, it exists just to help newbies learn about code-separation with MVCS.
  • No command-pattern.
  • I created it in 90 minutes. Ha.

6. StrangeIoC

Here we add to organizational benefits of MVCS the ease-of-development feature called inversion of control (IoC). To learn more. Here is the official Strange diagram of the MVCS overview and the StrangeIoC website.

Diagram
Diagram
Diagram
Hierarchy

Type: MVCS w/ IoC

Note: The source-code for this architecture is available below. It works great, but upon clicking to restart it breaks. Still working on that. Have a solution? Download the source and comment below this post. Please!

Note: Updated! Now see my complete article on StrangeIoC For Unity3D

Pros:

  • Public, Community-driven, well-documented. (e.g. You can hire/contract a new developer who arrives with this skill on day 1)
  • More decoupled, testable, & D.R.Y.
  • Scales-up well for large teams, large projects

Cons:

  • Slower to setup (but faster to add last-minute changes)
  • Steeper learning curve, especially for junior developers
  • Demands discipline/know-how from your team to put logic in its proper place (but removes the ‘where should we put that code?’ decision process)

Sample Game

  • Spider Strike 3D (Play The Game, View Video, Download Full Source-Code)
  • Paddle Soccer 2D (Play The Game, View Video, Download Full Source-Code)

What’s next?

Want to learn something more basic? Or are you ready for more advanced topics about UnityEngine and C#? Checkout my “Unity With Cocktails” HD Tutorial Video Series on C# and Unity.

Member Resources

[private_Free member]Enjoy this members-only content!

  • Download Bowling Game source-code (1. No Manager )
  • Download Bowling Game source-code (2. EmptyGO )
  • Download Bowling Game source-code (3. SimpleGameManager )
  • Download Bowling Game source-code (6. StrangeIoC )
  • Update: April 2014 – I don’t think any more source will be added to this post, until I add a new architecture to the list some day.

[/private_Free member]

What are your thoughts?

Do you prefer an alternative to the suggestions above? Or do you have an additional recommendation? Please comment below.

[polldaddy poll=7611650]

Play For Good: Volunteer Teaching

Category: Industry News     |     Tags: Business, Charity, Games

Giving & Gaming

People volunteer for a wide variety of reasons, especially wanting to help others. But it’s also OK to want some benefits for yourself from volunteering.

Susan J. Ellis, President of Energize, Inc explains that some people are uncomfortable with the notion that a volunteer “benefits” from doing volunteer work. There is a long tradition of seeing volunteering as a form of charity, based on altruism and selflessness. The best volunteering does involve the desire to serve others, but this does not exclude other motivations, as well.

Instead of considering volunteering as something you do for people who are not as fortunate as yourself, begin to think of it as an exchange.

Read the full, updated article at SamuelAsherRivello.com/playing-good-time-volunteer-teacher/

 

—

Find Your Next Unity3D Job

Category: Industry News, RMC News     |     Tags: C#, Games, Mobile, Unity3D

Finding Your Next Job

As game developers we have complete freedom to choose the tools and teams with which we work. Unity is of course a fantastic tool-set for game development and the industry is hungry for talent.

In fall 2013, I transitioned from consultant to full-time employee again to meet evolving career goals. At that time, I researched hundreds of full-time and freelance job postings for Unity game developers. To more deeply understand what are the most popular requirements for prospective employees, I’ve put together information on where to look for your next job, and what employees value in prospective employees. Take a look!

Where to look

Employers looking for Unity3D Developer talent post job listings on a variety of locations. Unity-related job listing sources;

  • jobs.gamasutra.com
  • videogamework.com
  • unity3dwork.com
  • forum.unity3d.com/forums/49-Commercial-Job-Offering
  • Twitter: @unity_jobs

Unity Job Position Titles There is quiet a variety of job titles which focus on Unity-focused game skills. Often the job list title does not include ‘Unity’ in the title, and you may get more results by omitting ‘Game’. However to focus the search results I include this list;

  • Unity (Game) Developer
  • Unity3D (Game) Developer
  • Unity (Game) Engineer
  • Unity3D (Game) Engineer

What Employers Want

Amount of Experience

Prospective employers like to see you have a few ‘shipped’ (launched) games in your portfolio.

  • 3-5 years for senior positions (0-2 for Junior)
  • 2-3 shipped game titles for senior positions (0-1 for Junior)

IMHO, this requirement is an vague predictor of value. Just like ‘years’ of experience. I have hired dozens of employees as well as subcontractors, and for me it is a far more effective indicator of future efficacy to discuss with the candidate his specific experience with ONLY the areas of the Software Development Life-Cycle (SDLC) which are germane to the role. This list includes; project planning, systems analysis, systems design, implementation (i.e. coding), integration and testing, installation/deployment, and maintenance.

Requirements For Senior Positions

The skills, responsibilities, and requirements of a position obviously depend on the company who lists the position, but here are some of the most common items. I’ve divided the skills among basic ‘employee‘ skills, positions with some manager responsibilities, and then between various programming disciplines. Each discipline is pretty separate — for example a job positions may require ‘game’ skills but not any ‘multi-player’ experience. All of these items are taken directly from real-world Unity-related job posts I have found. I included a short explanation for each item too.

Employee

  • Self-motivated: This is probably the #1 thing I see. Companies are trying more and more to be ‘flat-hierarchies’ where both power and responsibility are spread more evenly across all staff. You may see the management approach as ‘Kanban’, ‘Agile’, ‘team-based’, ‘cell-based’, ‘a studio of studios’ or something similar. Flat encourages each team-member to feel more ‘close’ to the project and ostensibly contribute more. I think it is a great philosophy. In my experience the ‘flatness’ is more ‘talk than walk’ — but that is ok. To fit in – be proactive, transparent, and communicative. If you ask AND answer your own questions, manage your own tasks, and speak before spoken-to about the challenges you are facing, you are on the right path.
  • Passionate: This is probably the #2 thing I see. I consider passion one of the most powerful things in life. Intrinsic appreciation brings intrinsic motivation. However, it is unfortunately rare that a company really cultivates passion in those who they don’t think have it.
  • Team-player: I feel item is most important for two reasons. One programming is a very personal, cerebral process. It is akin to putting ones thoughts into code. The same left-brained personality that is drawn to programming is NOT drawn to interpersonal communication and the vast challenges that exist there. Communication and empathy favor the right-brained. As the internet success bubble was building 10+ years ago, it was feasible to market your experience as a ‘rock-star’ programmer. This is someone who can come in and kick ass (as an individual). Rockstars contribute well to a management-less regime, and there were plenty of those. However, the HR & PM atmosphere has matured and we already see a more team-based approach. So because team-work is rare among programmers its important. Secondly, I am a strong believe that (especially in flatter hierarchies) we are all managers — meaning as super employees we all exist to leverage the skills of those around us in addition to our own direct contribution. As teams adopt more flexible, iterative development (see ‘Agile’) each team member is more of a thought-leader than just a ‘doer’. I feel strongly that it is the collaboration between those who are genuinely interested in excelling at collaborating which creates the virtuous cycle that turns good game projects into truly great ones. Can you amplify the effectiveness of your coworkers?
  • Excellent written, verbal communication: For the reasons just stated, programmers are not always good communicators. Besides the interview process (which is a historically horrible predictor of job performance), how can prospective employers evaluate the communication skills of an employee? That is indeed a challenge — and a great subject perhaps for another article. As a worker, it is recommended to educate yourself on communication as much as you do on technical skills. This requires an honest look inside at gaps in interpersonal skills. We all have them. At larger companies the HR department may have free resources on this; books, workshops, lectures. Your communication (emails and public speaking at meetings) should be honest, compassionate, and concise. At smaller companies it takes discipline and a champion – like yourself – to make the time for growth in communication skills.
  • Interested & capable to learn quickly: For any type of employee in any field, self-education is and will be increasingly valuable.  However, in technology this is paramount — especially as languages, platforms, devices, and consumer expectation are growing so rapidly.
  • Ability to work under high pressure deadlines: This is very common. Also is ‘we have a start-up like atmosphere’. I would call this ’emergency preparedness’ as emotional IQ skills. I think indeed that it is important. However it is trite (meaning-less from overuse) and it shouts ‘our management is disorganized’. Applying for a position listing this, it is recommended that you ask thoroughly about the expectation on utilization (expected hours per week) and access (emergency ‘work’-calls on nights and weekends) of employees.
  • Agile/Scrum project management experience: Instead of traditionally documenting 100% of a project and calendar upfront, teams are embracing a more realistic, ‘wait and see’ and ‘just-in-time’ organic process. Agile is not a match for all employees, and is certainly not a match for all (most) companies either. In the 7-8 years since this buzz-word as been mentioned to me in consulting projects, I have not met one team that FULLY embraces Agile.

I have found that my self-motivation and desire to learn voraciously to be some of my strongest attributes. I have found getting ‘out of my own head’ and bringing truer empathy to workplace dynamics to be an ongoing challenge. I have worked hard to add team-work and communication to my repertoire through intensive study and driving my experiences toward growth. At one large employer I was lucky enough to sponsor a 12-month team building program for me and my staff of 12 programmers. Not everyone loved it. It is hard to do ‘extra’ things at work when deadlines loom. However respecting the soft-skills (everything that is not technical) will come with the employee’s maturity.  

There is a very real chasm between programmers and designers. There is a chasm too between goals of making the game ‘fun’ and making the game ‘profitable’ (e.g. monetization and monetization metagames). Any employee who can bring efficiency and maintain morale between these groups will shine to upper-management. I’m very lucky to have a University art degree which gives me compassion for the challenges of artists working within increasingly technical workflows. On the fun-vs-profit I have learned hard lessons to defer-to and support whatever is the mission statement of the team/company. While I choose to be a programmer, my background brings a little more peace to my teams, I think.

Manager

Management responsibilities vary greatly between personnel management or project management. The trend of ‘flat hierarchy’ organization we see today often spreads these responsibilities to ‘normal’ staff and gets rid of dedicated management. So the normal staff (i.e. artist or programmer) who is ALSO handling management duties. While employees may embrace the theoretical meritocracy (anyone can be a leader), the loss overall from lack of academic management understanding (ostensibly lost because dedicated manager roles are lost) should not be underestimated. Also solitary team members, talented but socially awkward may not be compatible with such teams. Another potential loss. Position listings which require leadership of people or projects may include the following;

  • Conflict resolution: Foster a spirit of teamwork and unity among department members that allows for disagreement over ideas.
  • Plan Staffing Levels: Assess man-power vs work-load, assist HR in recruiting, interviewing, hiring.
  • Effective performance evaluation: Provide feedback through employee recognition, rewards, and disciplinary action.
  • Experience mentoring/coaching: A good manager leads, a great manager creates leaders.  Recognizing and allowing subordinates to flourish is critical. Guiding and cultivating requires maturing and generosity. This leader may champion other employees’ causes to upper management and HR too.
  • PM Software Expertise: Knowing the most common 20% of functionality in any one PM software (e.g. BaseCamp, Unfuddle, MS Project) is sufficient. However, I’ve seen managers that are so familiar with PM they can offer flexible per-team and per-project changes to the workflow. One size does not fit all in PM.
  • Agile/Scrum: Increasingly common. See ‘Agile’ above.

Programming – General

  • Write clean, documented code and also Employ object-oriented programming (OOP):  These are both legitimately vital and top the list of the most commonly required skills. If you are a best practice champion ( I absolutely am, but often waiver to the (lack of) seriousness of my clients), investigate your prospective employers techniques to establish (coding standards bible) and police (mandatory code reviews) such clean code. If the team does not make time for best practices, and most (especially in ad-agency based work) do not, then such practices will not be done.
  • Programming Language: The majority emphasize C#, some mention C# & JavaScript*. I have not seen any that mention Unity’s only other coding language — Boo. While rare, it is worth mentioning that positions specifically related to rendering disciplines may also ask for experience with Unity’s ShaderLab language. ShaderLab’s style it similar to CgFX and Direct3D Effects (.FX) languages and it is used to describes everything needed to display a Material.
  • Use version-control (GIT/SVN): Any mid-sized or larger team is using version control. I must assume. Smaller companies may not have the technical know-how to require it of you. In all cases use it! In my experience there are 3 levels of version-control experience; 1) you can update/commit fine but must call over a coworker for assistance on code-conflicts or other tasks, 2) You can handle all of that and you can ALWAYS fix your own mistakes, 3) You are the person who sets up build automation and answers other peoples git problems. Admittedly I my level is somewhere between #1 and #2. GIT is awesome, and scary.
  • Experience in AS3/Flash: This is VERY common in the listings and I believe this is for 3 primary reasons. First, the Flash has a very strong history in the casual game market starting around year 2000/2001. Second, the skills of a Flash game developer are directly relevant to a Unity game developer position. Lastly, due to strategic changes by Adobe, and the community’s reaction, many Flash game developers are looking for non-Flash jobs. Employers are smart to tap into the Flash game developer market. The ‘death’ of Flash was/is/and-will-be strongly exaggerated. As of 2014, really talented Flash developers still have their pick of top jobs in casual game development — including to a lesser degree in cross-platform mobile.
  • Experience in iOS/Android SDK: Unity teams deploying to these devices may need your native coding skills to create plugins for C# to speak directly to ‘hidden’ features in the device. Also, it is correctly assumed that if you know these platforms, you have experience creating for mobile (and handling some of the related challenges below).
  • Use test-driven development (TDD) practices:  While this one listed, I’m curious if the job really requires it and doubtful the team leaves time for it. Test-driven development is a strategy of creating unit tests ‘as you go’ for your work, rather than later or never. It is proven to yield less breakable, less bug-prone code, but it is FAR less practiced than listed. Kudos to prospective employers who dreaming big and list this in the job post, but it is trite. The best code I have written (with respect to stability) has been on TDD teams, however some of the most frustrating projects have been where such best practices are required but not allocated for (expertise, time, workflow, accountability).

*JavaScript and UnityScript are synonymous here

Programming – Game

  • Passion for games: EVERYONE lists this. Trite. Obviously important.
  • Mobile: Handle device-specific features (accelerometer, camera, etc…), mobile api’s (Ad integration, in-app purchases, etc…), and mobile development workflow (app-store submission, etc…)
  • Cross-platform: Handle multiple screen resolutions and cross-platform workflow
  • 3D: Knowledge of 3D-specific math (Vector, matrices, etc…) provides value to working on core game mechanics and camera (following, avoiding, line-of-sight) systems.
  • AI: Chain of command algorithms to patrol, seek, attack, the player, etc…
  • Rendering: Experience creating shaders allows you to shape the way the game is rendered, creating unique looks like we see in Limbo and Geometry Wars.
  • GUI: Handling input and layout of buttons, text, and overlays. On your team, this worker may be the artist with the most programming skills or the programmer with the most art skills.
  • Prototype creation: Some developers like working with established, proven API’s and common mechanics. Those who demonstrate incredible creativity and communication and also favor more experimentation, hacking, and are at-home with loose requirements/documentation can excel at the earliest stages of pro-typing new game and app concepts.

Programming – Cross-device

  • Mobile: Working on mobile presents many, many challenges. Small screen-size, multiple-screensize, touch input, device-specific features, and more…
  • Ability to optimize: While always important in software, and increasingly important for games, optimization is of paramount importance on the resource-starved mobile devices. Knowledge in optimizing rendering for fast and stable frame rate as well as optimizing for low file-size and low ram-consumption are most commonly requested.
  • Multi-screen: The business requirement to launch on computer, phone, and tablet requires games to be flexible and (asset) workflows to be well-organized. While primarily important to UX and UI experts on your team, these concerns will touch your life too.
  • Multi-platform: With middle-ware tools like Unity, game developers are both blessed and cursed by the write-once-deploy-everywhere paradigm.  Your game projects can do more for more potential game players, but this often requires (figuratively) forking your code to handle the various deployment paths. Team leaders with good solution/design patterns should set the tone, but each developer must be cognizant of the readability and flexibility of her code.

Programming – Tools / Systems

The workflow of every game project includes making some tools to assist the development process. Unity’s incredible editor scripting together with the Asset Store marketplace, make tool-development skills even more relevant and marketable. While on small teams these responsibilities may not be expansive, larger teams often dedicate one or more developers exclusively to the creation of tools.

  • Tool/API design for coworkers: Very very different than traditional end-user-focused development, designing and developing systems with your fellow coworkers in mind has its own batch of challenges. Analyzing upfront what the needs of your team will be requires both experience and technical know-how as well as excellent leadership and communication skills to discuss needs with your team. Unity is so very friendly at tool-creation even one-man-teams need tools. When your team size is 5 to 8 (very common today), a proactive developer can save precious resources with intelligent work-flows and tools. A few examples include level-editors for in-IDE level generation and well-designed API’s to send high-scores from the game to your companies back-end systems.
  • Extend Unity: Knowing the UnityEngine and UnityEditor API’s related to creating custom inspectors, custom windows, gizmos — all greatly expanding what you and your team can do with the Unity IDE is of critical importance. This is the ‘how’ which correlates to the last bullet item.
  • Knowledge of CMS: Your Tool/API may very well speak to a back-end for level-data, user-data, or more info. Knowing how to use a Content Management System (CMS) is a no-brainer requirement, but mastery on CREATING them and setting up easy to use workflows for technical and non-technical team members is really valuable.
  • Knowledge of back-end/database: You may need to program server code or collaborate with those who do. Knowledge with common languages (PHP, .NET, etc…) and tasks (database setup) are important.

Programming – Multi-player

  • 3rd Party Multi-player API Experience: Knowing the Xbox Live, PSN, Steamworks…
  • Good knowledge: of contemporary competitive and cooperative multi-player gaming paradigms
  • Latency/Lag-Hacking: Handling client-prediction algorithms to minimize loss of perceived world-sync for end users.

Programming – Unity Specific Stuff

In addition to the requirement of ‘must know ‘UnityEngine API’ we also see…

  • Must have Unity-Pro License: This requirement is listed in freelance jobs (I have no problem with that) and also (surprisingly) in full-time jobs. It reeks of an employer that does not provide you your computer workstation and the software on it — which is a very real red flag. In a way this is a indirect requirement that you are familiar with the few (honestly) critical pro-only features, but I find it to be a sloppy investigation.
  • Knowledge of Packages: The most common 3rd party libraries I see mentioned are NGUI (easily the most common), 2DToolkit, and surprisingly Playmaker. I think PlayMaker is great and has uses on nontechnical and expertly technical teams, but I’m very surprised its greatness has bubbled up already to job listings.

Unity3D Dev Diary: uEventDispatcher

Category: RMC News     |     Tags: Debugging, DevDiary, Testing, Unity3D

About RMC & Unity3D

Rivello Multimedia Consulting (RMC) provides consulting services for applications and games. RMC specializes in Unity3D development (see our work here). Please contact us today with any questions, comments, and project quotes.

uEventDispatcher

Problem

Unity3D is a great gaming IDE and runtime. Like any tool I use regularly, I have many constructive criticisms as well. For example, there is no adequate one-to-many messaging system. The UnityEngine includes BroadcastMessage & SendMessage but it is not adequate and has many public, deserved criticisms.

Solution

Streamline messaging between classes using uEventDispatcher.

Benefits include;

  1. Easily add/remove and dispatch custom communication
  2. Strongly-typed data payload
  3. Compiler properly warns you about major misuse cases (mistyping, etc…)
  4. Works within any class type and requires no special ‘Interface’ or ‘Inheritance’
  5. Does not rely on reflection (slow performance) like BroadcastMessage/SendMessage

Usage

Here is an example that shows the COMPLETE API of uEventDispatcher.

[code]

//————————————–
// Imports
//————————————–
using UnityEngine;
using System.Collections;
using com.rmc.events;

//————————————–
// Class
//————————————–
public class TestEventDispatcher : MonoBehaviour
{

//————————————–
// Properties
//————————————–
// PRIVATE
private EventDispatcher eventDispatcher;

//————————————–
// Methods
//————————————–

// PUBLIC
/// <summary>
/// Start this instance.
/// </summary>
void Start ()
{

//CREATE
eventDispatcher = new EventDispatcher (this);

//ADD 0, 1, 2, OR MORE LISTENERS…
eventDispatcher.addEventListener (TestEvent.TEST_EVENT_NAME, _onCustomEvent1); //default is EventDispatcherAddMode.DEFAULT
eventDispatcher.addEventListener (TestEvent.TEST_EVENT_NAME, _onCustomEvent2, EventDispatcherAddMode.SINGLE_SHOT);

//TEST REMOVE
//eventDispatcher.removeAllEventListeners();
//eventDispatcher.removeEventListener (TestEvent.TEST_EVENT_NAME, _onCustomEvent1);

//TEST HAS
//Debug.Log (" hasEventListener(): " + eventDispatcher.hasEventListener (TestEvent.TEST_EVENT_NAME, _onCustomEvent1));

//TEST EVENT SETUP FROM 3 DIFFERENT SCOPES
eventDispatcher.dispatchEvent (new TestEvent (TestEvent.TEST_EVENT_NAME));

}

//————————————–
// Events
//————————————–
public void _onCustomEvent1 (IEvent iEvent)
{
Debug.Log (" 1. _onCustomEvent1(): " + iEvent);
}

public void _onCustomEvent2 (IEvent iEvent)
{
Debug.Log (" 2. _onCustomEvent2(): " + iEvent);
}

}

[/code]

Status

The project is now complete and live on the AssetStore. It is free. Check it out today!

Unity3D & C# Design Patterns

Category: Quick Tips     |     Tags: C#, Design Patterns, Games, Mobile, Unity3D

As always, RivelloMultimediaConsulting.com/unity/ will be the central location for deep articles and tutorials, Facebook.com/RivelloMultimediaConsulting (like us!) will engage the growing RMC+Unity community, and for the latest opinions and cool links follow me at Twitter.com/srivello.

Design Patterns Defined

As BlackWasp explains, Design patterns provide solutions to common software design problems. In the case of object-oriented programming, design patterns are generally aimed at solving the problems of object generation and interaction, rather than the larger scale problems of overall software architecture. They give generalised solutions in the form of templates that may be applied to real-world problems. Design patterns are a powerful tool for software developers. However, they should not be seen as prescriptive specifications for software. It is more important to understand the concepts that design patterns describe, rather than memorizing their exact classes, methods and properties. It is also important to apply patterns appropriately. Using the incorrect pattern for a situation or applying a design pattern to a trivial solution can over-complicate your code and lead to maintainability issues. A group of developers, the Gang of Four, publicized these 23 design patterns.

Creational Patterns
1. Abstract Factory Creates an instance of several families of classes
2. Builder Separates object construction from its representation
3. Factory Method Creates an instance of several derived classes
4. Prototype A fully initialized instance to be copied or cloned
5. Singleton A class of which only a single instance can exist
Structural Patterns
6. Adapter Match interfaces of different classes
7. Bridge Separates an object’s interface from its implementation
8. Composite A tree structure of simple and composite objects
9 .Decorator Add responsibilities to objects dynamically
10. Facade A single class that represents an entire subsystem
11. Flyweight A fine-grained instance used for efficient sharing
12. Proxy An object representing another object
Behavioral Patterns
13. Chain of Resp. A way of passing a request between a chain of objects
14. Command Encapsulate a command request as an object
15. Interpreter A way to include language elements in a program
16. Iterator Sequentially access the elements of a collection
17. Mediator Defines simplified communication between classes
18. Memento Capture and restore an object’s internal state
19. Observer A way of notifying change to a number of classes
20. State Alter an object’s behavior when its state changes
21. Strategy Encapsulates an algorithm inside a class
22. Template Method Defer the exact steps of an algorithm to a subclass
23. Visitor Defines a new operation to a class without change

Design Patterns for Unity 3D / C#

C# is a robust language, and all popular design patterns are possible. However, which design patterns are most appropriate to Unity3D and game development?

1. Which patterns above are ‘built-in’ to the Unity3D experience?

I’m curious of your help here. Please add a comment below.

2. Which patterns above would you like to see in my training series?

My Unity3D & C# HD Video tutorial series will feature sections about architecture and design patterns. What would you like to see covered? [polldaddy poll=7364605]

Unity3D Unit Testing 1

Category: Quick Tips, RMC News     |     Tags: Debugging, Testing, Unity3D

About RMC & Unity3D

Rivello Multimedia Consulting (RMC) provides consulting services for applications and games. RMC specializes in Unity3D development (see our work here). Please contact us today with any questions, comments, and project quotes.

As always, RivelloMultimediaConsulting.com/unity/ will be the central location for deep articles and tutorials, Facebook.com/RivelloMultimediaConsulting (like us!) will engage the growing RMC+Unity community, and for the latest opinions and cool links follow me at Twitter.com/srivello.

Update: December 18, 2013, Unity Technologies releases the official “Unity Test Tools.” Read the full post below, then jump over to “Unity3D Unit Testing 2: Unity Test Tools“.

Intro To Unit Testing

As the author of the Art Of Unit Testing begins, “I used to feel that a ‘unit’ was the smallest possible part of a code base (a method, really). But in the past couple of years I’ve changed my mind”. Unit Testing is a fundamental of Extreme Programming too. Here’s how I define a unit test;

A unit test is an automated piece of code that invokes a unit of work in the system and then checks a single assumption about the behavior of that unit of work.

A unit of work is a single logical functional use case in the system that can be invoked by some public interface (in most cases). A unit of work can span a single method, a whole class or multiple classes working together to achieve one single logical purpose that can be verified.

A good unit test is:

  • Fully automated
  • Consistently returns the same result
  • Tests a single logical concept in the system

Reasons To Write Unit Tests

Development experts urge us all to test. Here are some top reasons;

  • Tests Reduce Bugs in New Features
  • Tests Reduce Bugs in Existing Features – With well-tested code, introducing new features rarely breaks existing functionality.
  • Tests Are Good Documentation – A concise code example is better than many paragraphs of documentation.
  • Tests Allow Refactoring \ Reduce the Cost of Change – Be more nimble. Experiment with confidence.
  • Testing Forces You to Slow Down and Think
  • Tests Reduce Fear – Having a complete test suite allows programmers to remove the fear of making changes or adding new features.

Unit Testing in Unity

So in Unity, we have three levels that need to be continuously tested:

  • C# code
  • Prefabs and single configured objects
  • Scene definitions for the final game – also known as levels.

There are some challenges to each, however the 3rd is probably the most tricky since much of its setup is done in visually through the editor (vs in C#). One tip is to configure all Game-Objects as prefabs, so that the scenes only contain a minimum of manual definitions. Some greater thought on the subject is outlined in this post.

The Unity Technologies team (creators of the Unity IDE) announced in 2013 Unity’s Runtime API Test Framework. While this is a great sign of the teams dedication to TDD (see next section) and to create tested, durable code for us to use, this framework is not available for us developers to use. The team released this chart showing how much of the Unity code-base is currently covered by testing (see Figure 1).

Figure 1. (Updated August, 2013)

Figure 1. (Updated August, 2013)

Test Driven Development (TDD)

TDD is the practice of creating your tests while you implement (rather than after). Moreover, TDD developers create the test first (returning the simplest incorrect value), runs it to see the failed test result, then implements the correct, complete implementation. The unit testing leads or ‘drives’ the programming workflow. This requires discipline but leads to a codebase with (good) heavy test coverage.

To perform a test you need 3 things; a testing framework to run the tests, you need the tests, and then you need something to test. Here is an example of a test and something being tested.

Example Test (Pseudocode)

//ASSUMING YOU HAVE A CUSTOM 'DoIntAddition' METHOD TO TEST...

[Test]
public void DoIntAdditionTest() {

//SETUP
int value1_int = 10;
int value2_int = 1;

//TEST
int result_int = DoIntAddition (value1_int, value2_int);

//EVALUATE VIA ‘ASSERTION’
Assert.IsTrue(result_int == (value1_int + value2_int) );
}

Example Test (Summary)

  1. Most Unit Testing Frameworks have some meta-tags (attributes) such as [test] that is used to indicate which methods are ‘test methods’
  2. You do any setup needed to cleanly prepare for your test (optional)
  3. You perform the test (such as calling a custom method to be tested as shown)
  4. You evaluate using an assertion. An assertion is your way as the tester to suggest the expected behavior. In this example it seems almost too simple, almost silly to test this method. However, once you create the test, you can be forever confident that the ‘DoIntAddition’ method will perform as expected, even if you later change the implementation of the method. This is the confidence you gain from Unit Testing.

Challenges In Unit Testing

General

Unit testing requires discipline from the team. Team leaders and project stakeholders must allow time not only to add the user-facing features, but also to create non-functional features such as under-the-hood unit tests for the codebase. Each team member too must be responsible for his or her own code. Writing tests for your own code (beforehand as in TDD per above) or during development is best.

First and foremost, a game is different to many other types of software in that a good portion of the code is handling input, and visuals/graphics/UI. These are two notoriously “un-unit-testable” parts of a system.

To help these issues, you can start by separating your visuals from your logic. This will make the logic more testable.

Specific Challenges for Unity3D

A staple of Unity development is the heavy use of the MonoBehaviour class. There is always logic in MonoBehaviours that you simply cannot take out and test in isolation. Now if you try to simply instantiate a MonoBehaviour in your script you will see this error in the console: You are trying to create a MonoBehaviour using the ‘new’ keyword. This is not allowed. MonoBehaviours can only be added using AddComponent(). Alternatively, your script can inherit from ScriptableObject or no base class at all. Each Unit3D testing frameworks has a solution to this issue. See the documentation for the framework you choose.

Another problem is the tight coupling of scripts to UnityEngine.dll*, which is not testable; if code depends on UnityEngine directly I can’t give it a mock implementation under my control, ergo it is not testable. This post covers more about the issue.

Links

Unity3D Unit Testing Articles

  • Unit Testing In Unity3D (Great Overview)
  • Organizing Unity3D for Unit Testing

Unity3D Unit Testing Frameworks (Packages)

  • Test Star (Very robust, but costs money)
  • NUnitLite
  • UUnit
  • Sharp Unit
  • Autopilot for TestFlight

Unity3D Dev Diary: uMOM 1

Category: RMC News     |     Tags: Debugging, DevDiary, Testing, Unity3D

About RMC & Unity3D

Rivello Multimedia Consulting (RMC) provides consulting services for applications and games. RMC specializes in Unity3D development (see our work here). Please contact us today with any questions, comments, and project quotes.

uMOM

Problem

Unity3D is a great gaming IDE and runtime. Like any tool I use regularly, I have many constructive criticisms as well. For example, there is no default Main.main() type ‘hook’ to centralize the entry into your runtime and no default way for UI and code to persist from scene to scene. I created a monolithic ‘SimpleManager’ class (see my HD training course video on architectures for more on that), however it is purposefully limited in scale. It is essentially a single manager packed with disparate responsibilities (sound, levels, object pooling, etc…). I knew there was a better solution.

Solution

Welcome to the Unity3D Manager of Managers (uMOM), pronounced as /you-mom/. I’m currently developing uMOM for the AssetStore.

The purpose of uMOM lean;

The uMOM package allows developers to add one or many reusable, custom manager classes to the project. Each ‘start’ automatically, have a predictable lifecycle (reset, add, update, remove), optionally receive ‘update()’ calls, optionally run during edit mode, and optionally persist between scenes. Managers operate as singletons and can easily address each other to collaborate.

Types of uMOM Managers

Really anything is possible, but here is the short list of use cases I will address first. Use some of mine or none of mine – then create your own. Most any existing mananger class you have can easily be converted for compatibility here. 

  • uEventManager -Streamline messaging between classes. Replace the need for Unity’s clunky ‘SendMessage’ and instead dispatch strongly typed objects. (The uEventManager will also be available separately).
  • Store references to audio clips (drag-n-drop) and control audio playback via C# from one place.
  • GUIManager – Layout UI which optionally persists between scenes. Centralize the controls to handle clicks, etc…
  • PoolManager – Optimize your run-time performance by persisting GameObject or prefab instances in RAM and displaying them as needed.
  • LevelManager – Queue up levels and perform transitions (e.g. fade-in-out) between them.
  • GameManager – While other managers are not project specific, this one likely is. Here you manage the core game mechanics, how the user wins and loses, store the score, etc…
  • SaveManager: Takes care of saving and loading user preferences and achievements.
  • MenuManager: Controls all menus, managing their animations, their contents, and their behaviors. Perhaps it heavily uses the GUIManager for layout.
  • Much, much, more…

The instructions of uMOM are concise;

  • 1. Select an existing uMOM manager class (from me, from the community) or create a new uMOM manager which subclasses BaseManager (which extends ScriptableObject). The class acts basically as an interface (because interfaces don’t serialize in Unity3D), allowing you maximum freedom in how you implement.
  • 2. Use the uMOM Unity Editor Window (See Figure 1) for all your needs. All compatible scripts in your project, regardless of folder location are shown here.
  • 3. Click ‘Convert’ (one time only) for the desired script. This efficiently creates a new ScriptableObject (e.g. MyManager.asset) for the original MonoScript (e.g. MyManager.cs)
  • 4. Click ‘Add’ (one time only) for the desired script. It is that step that actually puts your manager into use. Cool! You can click ‘Remove’ if you don’t want the manager to be in-use anymore.
  • 5. Edit your manager class source code however you like. No need to repeat the steps, your changes are hot-updated to the project. All this works in Edit Mode Or Play Mode.
Figure 1. (In Progress)

Figure 1. (In Progress)

 

Problems & BUGS!

During development I have hit many obstacles. All my issues continue to exist, even with the recent Unity 4.2.x release. Developing Unity Editor tools is a unique challenge compared to straight game development and it is unlike any other platforms I’ve used before. I’m sure all of these challenges can be solved.

I would LOVE some help resolving these issues. See this list (I’ll record a video soon if that would help you) and please comment below if you have confidence to solve any one area. I can share the code with you. I ask that any assistance be Work for Hire. Unfortunately on this particular project there is no partnership or co-ownership available. Once I have the project working, I plan to offer it as a premium package in the AssetStore.

1. Serialization

The uMOM class directly edits its public properties (as it should, right?). The many editor classes edit the SerializedObject and SerializedProperty of uMOM’s public properties (as it should right?). However in many places I see that I must STOP, change a value with a click in the uMOM Editor Window, then PLAY to have a change persist. Otherwise the change is lost next time I play/pause.

I have no workaround and I assume the issue is within my code. IDEAS?

2. Finding ‘All’ Assets

The uMOM Editor Window shows a list of all compatible MonoScripts (meaning all MonoScripts in Project window which extend BaseManager). That works. However, the programmatic listing of all compatible ScriptableObjects (meaning all ScriptableObjects in the Project window which have a type of a compatible MonoScript) is not so easy. Unity returns the ‘loaded’ (loose term) instances I want, but not ALL of them. The issue is well known (here, and here, and here, and more).

The common workaround I read online is to manually (with mouse) or programmatically (loop through all assets and call AssetDatabase.Load… [this crashes Unity IDE] or Selection.objects [This works inconsistently]… to ‘refresh’ the assets it can find). Manually = works but is not a long-term solution. Programmatically does not work.

Based on research I think this is a known Unity bug that Resources.FindObjectsOfTypeAll() and its deprecated equivalent Object.FindObjectsOfTypeAll, just do not really give you ‘all’. IDEAS?

Please Vote!

You can vote on this known bug (problem #2 above) here “Make FindObjectsOfTypeIncludingAssets find all just like the object picker” to encourage the Unity team to fix this issue. If you have nothing else to vote on, please cast your votes this way!

Unity3D Version 4.2 Released!

Category: Industry News     |     Tags: C#, Flash, Games, Mobile, Unity3D

Learn Unity 3D & C# – From Basics to Advanced

Unity3D is a powerful suite of tools (Project IDE, Code IDE, run-time) for game development. Read my full articles of “Introduction to Unity3D” and “Tutorial Series: Unity3D & C#“.

There is incredible momentum in the Unity3D product and its community. Here is a look at key features of the latest release.

Top Unity3D 4.2 Features

My top 3 ‘Free Unity’ version features per category are here;

New platforms

  • Windows Phone 8 (Yes!)
  • Windows Store (Yes!)
  • BlackBerry 10 (Yes!)

‘Free Unity’ Features (Formerly Pro Unity Features)

  • Realtime shadows (one-directional light only; hard shadows only). (Yes!)
  • Text-based serialization of materials, prefabs, scenes etc. for easier version control. (Yes!)
  • NavMesh baking (OffMeshLinks still require Pro).

Graphics

  • OpenGL for Android
  • Shuriken Collision Event Callback Scripting
  • (None)

Editor

  • Preset Libraries: Create new libraries and save. (Yes!)
  • Platform switching, player building and asset importing can now be cancelled.
  • (None)

See Unity’s official 4.2 announcement here.

Want More Video Tutorials?

We are currently creating tons of new training content for Unity3D.

[polldaddy poll=7125741]

Page 1 of 3123

Tag

3D AIR API AS3 AS3.5 AssetStore Augmented Reality Business C# Charity Debugging Design Patterns DevDiary ECS Architecture Experimental Flash Flex Game Design Game Design Prototypes Games GUI HTML5 Java Loom Mobile MVCS Architecture Optimization Project Planning PushButtonEngine ReactiveExtensions Review Robotlegs Smash Testing Unity3D UnityApplicantTest WordPress WordPress Plugin

Brazilean Developers

  • Abendita.com
  • dclick.com.br
  • dm9.com.br
  • Fellyph Cintra
  • IgorCosta.org
  • MonadaSolucoes.com.br
  • PossibleWorldwide.com.br
  • Unit9.com

Developers

  • Adobe Blogs
  • Ben Forta
  • Colin Moock
  • Enrique Duvos
  • Flash Mobile Blog
  • Jess Freeman
  • Kevin Hoyt
  • Lee Brimelow
  • Paul Trani
  • Quasimondo
  • Renaun Erickson
  • Ryan Stewart

Free Assets

  • Free Sounds
  • HasGrafics

HTML5 Games

  • Closure JS Library
  • Eloquent JS Manual
  • Game Framework – CraftyJS
  • Game Framework – EaselJS

Italian Developers

  • alchimedia.com
  • corlan.org/
  • creativesource.it
  • dimix.it
  • fabiobiondi.com
  • gnstudio.com
  • Interpreting-tech.com/bemobile/
  • leonardorisuleo.info
  • lucamascaro.info
  • mart3.org
  • mxml.it
  • nxn.it
  • pirosoft.it
  • Preload.it
  • sonnati.wordpress.com/
  • webgriffe.com

Products

  • Adobe.com
  • Amazon Kindle E-Reader
  • ElectroServer
  • F*CSS
  • Flash Development Toolkit (FDT)
  • O'Reilly PureMVC Book
  • Samsung Galaxy Tablet
  • Unity3D

RMC

  • RMC Consulting

Spanish Developers

  • Flash Adictos
  • HTML Cinqo
  • Tutoriales Flash

Tutorial

  • Active Tuts
  • AS3-to-Unity3D Training Videos
  • Doing 2D in Unity3D
  • Learning C#
  • Unity3D Tutorials

Unity3D Games

  • AS3-to-Unity3D Training Videos
  • Doing 2D in Unity3D
  • Learning C#
  • Matt Eley's Blog
  • Unity3D
  • Unity3D Tools
  • Unity3D Tutorials

Interesting links

Besides are some interesting links for you! Enjoy your stay :)

Latest Portfolio

  • Coins And PlatformsMarch 19, 2014, 6:04 am
  • Paddle SoccerMarch 2, 2014, 9:13 pm
  • Spider StrikeFebruary 21, 2014, 4:19 am
  • Custom Game System APIJuly 8, 2013, 8:05 am

Latest News

  • RMC Primer: Everything Virtual Reality (VR)September 3, 2016, 10:29 am
  • Unity3D Architectures: EntitasJuly 29, 2016, 11:15 pm
  • RMC Primer: Get A Job In Game DevelopmentAugust 19, 2015, 10:18 am
  • Unity UI: Overview – Part 1 of 3December 10, 2014, 9:55 am

Archive

  • September 2016
  • July 2016
  • August 2015
  • December 2014
  • April 2014
  • March 2014
  • February 2014
  • January 2014
  • December 2013
  • October 2013
  • September 2013
  • August 2013
  • July 2013
  • June 2013
  • May 2013
  • December 2012
  • October 2012
  • September 2012
  • July 2012
  • May 2012
  • April 2012
  • March 2012
  • February 2012
  • January 2012
  • December 2011
  • October 2011
  • September 2011
  • August 2011
  • June 2011
  • April 2011
  • March 2011
  • January 2011
  • December 2010
  • October 2010
  • September 2010
  • April 2010
  • March 2010
  • January 2010
  • October 2009
  • August 2009
  • June 2009
  • May 2009
  • April 2009
  • January 2009
  • December 2008
  • November 2008
  • August 2008
  • May 2008
  • April 2008
  • February 2008
  • January 2008
  • December 2007
  • November 2007
  • October 2007
  • August 2007
  • May 2007
  • January 2007
  • October 2006
  • April 2006
  • March 1999

© Copyright 2006 - 2023 - Rivello Multimedia Consulting - RMC by Samuel Asher Rivello