x


Placing gamelogic in separate library / VS project

Has anyone experienced with designing the gamelogic in a different library (dll)? This gives you the possiblity of (unit)testing and blackboxing logic that could be reused at some point.

I'm currently working on a project using this approach, but I'm having some troubles with Unity automatically resyncing the VS solutions, excluding the gamelogic project. Does anyone know a fix for this?

The main goal is to have a VS solution which contains more projects (e.g logic & testing) than the Unity project itself.

more ▼

asked Oct 25 '10 at 05:30 AM

Rasmus Schlnsen gravatar image

Rasmus Schlnsen
697 10 15 28

Have you checked into UUnit testing framework for unity?

Dec 26 '10 at 09:47 PM Statement ♦♦
(comments are locked)
10|3000 characters needed characters left

3 answers: sort voted first

What I did in my current project was just to duplicate the auto generated solution, rename it, then add new projects to it.

Because unity recreates the .csproj each time, this keeps the new solution up to sync, though it does tend to swap back to the original project when you double click a file

more ▼

answered Feb 26 '11 at 09:15 PM

Mike 3 gravatar image

Mike 3
30.7k 10 67 256

This behavior is insanely annoying, but I never thought of something so simple as editing from a different .csproj. Thanks for pointing that out. :)

Apr 23 '11 at 08:06 PM Ipsquiggle
(comments are locked)
10|3000 characters needed characters left

You need to be more specific than "gamelogic". If you have specific self-contained components, then those should be good to separate/unit test; however most gameplay scripting is tightly coupled to the engine (e.g. physics) which you can't separate, because there's no way to update the state of rigidbody. Also you can't unit test for things like "is this fun?"

more ▼

answered Oct 29 '10 at 08:07 AM

Max Kaufmann gravatar image

Max Kaufmann
588 10 12 21

His "main goal" was to add more projects to the vs solution (which unity overwrite). He didn't ask to test "is this fun".

Dec 26 '10 at 10:54 PM Statement ♦♦
(comments are locked)
10|3000 characters needed characters left

You should create a separate test folder as a sibling of the Assets folder, inside which you should create your test solution. It should contain your test project and it should reference the automatically generated projects that Unity maintains.

This is the approach used by Uniject, the testability framework for Unity, which you can find on github - https://github.com/banderous/Uniject

You can find out more about Uniject here

more ▼

answered Oct 19 '12 at 11:59 AM

Banderous gravatar image

Banderous
111 1 2 3

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x78
x62

asked: Oct 25 '10 at 05:30 AM

Seen: 1210 times

Last Updated: Oct 19 '12 at 11:59 AM