Image RSS Feed Latest Screens
red team signature unity_com unity_com
Blog RSS Feed Report abuse Latest Blog: CATIA, Unity and COM

1 comment by Herr_Alien on Apr 26th, 2010

If you already programmed in COM, feel free to skip the article. Yep. Nothing interesting for you here.

If you're a coder that has some experience with previous game engines but you're new to Unity, then read on.

So. Two programs and a technology for software development. And a picture:COM object and interfaces

That's a COM object. Our target is "Outer Object". It imlements several interfaces, the circles labeled A, B ...

In terms of inheritance, you could do that by deriving the class describing. Now of course, there are some problems when all them interface implement a function with the same signature, say void Update(): which Update() should be called in your case? The one from A? Or B? Or C? I personally don't like C, as a vitamin at least it is sour.

This is where COM ... comes in place. In COM, if you want to implement an interface on an object, you'll get a new instance of a class. That means that somehow, in your objects, you'll have at least three class instances, one that implements the functionality of A, one for B, well, you get the point.

Why the frowned face? Oh, stupid me, I forgot something: from now on, your object is no longer an instance of one class. No. That's gone. Think of it as a collection of classes, each working together to provide functionality for one object.

Now I can hear you saying: "But what if I need to use functionality from Interface A in the implementation of Interface B? How can I reach one functionality from the other?"

In all technologies that implement an object modeling mechanism (yep, that's the OM from COM), there will always be a mechanism to go from one interface to the other. In COM, it is called "QueryInterface". In Unity, you  GetComponent.

Now it makes sense. This is why the First Person Controller prefab in Unity looks like this:

Unity's fps controller 



You'll see that I underlined two components (get used to the term if you plan to use Unity). If you double click them, you'll end up looking at some C# code. Each of the scripts describe a class, each having a Start() and Update() function. Several components, working to define one object.
And here's another thing about COM: you can re-use components:

camera



The Mouse Look script is the shared component here.

That's it. Don't say I didn't warn you, if you know COM this was not a surprise.

Media RSS Feed Latest Video
Groups
2D Games

2D Games

Fans & Clans group with 136 members, open to all members

They are places where "Z axis" does not exist, only YX reign, the word is unknown 3D, games are simple but should be played, many of them will make us...

AvP2 Fortress

AvP2 Fortress

Fans & Clans group with 5 members, open to all members

This is the group of AvP2 modders responsible for developing the AvP2Fortress mod. If you whish to join us, please send us an e-mail.

Desura

Desura

Official group with 10,085 members, open to all members

Desura is a community driven digital distribution service for gamers, putting the best games, mods and downloadable content from developers at gamers...

Modding Social Club

Modding Social Club

Entertainment & Press group with 127 members, open to all members

The problem with multiplayer mods is the lack of players; the solution is to play them. That's where the Modding Social Club (MSC) at ModDB comes in...

Serious Sam Fans

Serious Sam Fans

Fans & Clans group with 106 members, open to all members

The coolest social group on ModDB! Join if you play Serious Sam: The First Encounter, Serious Sam: The Second Encounter or even Serious Sam 2 or 3. Join...

shadowblaze clan

shadowblaze clan

Fans & Clans group with 2 members, open to all members

read below because that is our rules please obey them or it wil result in punishment if you dont obey the punishment you will be kicked from the group...

Share and Mod

Share and Mod

Hobbies & Interests group with 54 members, open to all members

Share and Mod is a group dedicated to sharing art assets for the Moddb community to help others out and to better mods needing help.

Post comment Comments  (0 - 10 of 26)
oleomingus
oleomingus Aug 15 2012, 6:01am says:

Thank you for tracking our game - "somewhere"
we really appreciate the interest.

+1 vote     reply to comment
IrrSoft
IrrSoft Aug 2 2012, 12:08pm says:

Thank you for tracking our game (3:00 am Dead Time). Remember that the new trailer will be available very soon as well as the first playable beta (for the funders, starting from 5 dollars).
Thanks for your support!

+1 vote     reply to comment
JamoGames
JamoGames Feb 20 2012, 10:45am says:

Hi there Alex,
Thanks for following Amp, Watts & Circuit! The full game is out now, you can grab yourself a copy here - Indievania.com
Thanks for supporting the game, I would love to hear what you think of the full version, and what you would like to see in future updates. Feel free to come chat to me about any ideas that you might have! It is built in Unity too so that might be of interest to you!
Thanks,
James Biddulph

+1 vote     reply to comment
dreamtail
dreamtail Jan 3 2011, 2:51am says:

I haz one thing to say Herr CODE!!!!!!!!

+1 vote     reply to comment
exaltstudios
exaltstudios Nov 9 2010, 4:50am says:

Thanks for tracking my game Silas!

+1 vote     reply to comment
haxorfox
haxorfox Aug 12 2010, 6:23pm says:

I heard you are no longer updating Savior patch for AVP2, is this true?

+1 vote     reply to comment
Herr_Alien
Herr_Alien Sep 16 2010, 5:12am replied:

That's right. The game doesn't require an independent master server, it relies on Gamespy now. That, and the fact that we released the code to the public means that we're no longer needed. In a good way :) .

+1 vote     reply to comment
shabazzster
shabazzster Jul 7 2010, 12:39pm says:

Okay and how can I implant this in my game? would i be able to use it to display say, a scene within a scene somewhere within a game to provoke more storyline information?

+1 vote     reply to comment
mrinal
mrinal May 4 2010, 4:28am says:

thanks for adding me as ur friend.

+1 vote     reply to comment
Herr_Alien
Herr_Alien Mar 4 2010, 2:55am replied:

Multam!
La Master Server Patch am lucrat impreuna cu un tip din Canada, Jeff Attwood.

+1 vote     reply to comment
Post a Comment
click to sign in

You are not logged in, your comment will be anonymous unless you join the community today (totally free - or sign in with your social account on the right) which we encourage all contributors to do.

2000 characters limit; HTML formatting and smileys are not supported - text only

Level
Avatar
Avatar
Offline Since
Oct 1, 2014
Country
Romania Romania
Gender
Male
Member Watch
Track this member
Accolades
Desura
Statistics
Activity Points
2,857
Rank
476 of 474,526
Watchers
4 members
Time Online
1 month
Comments
351
Site Visits
16,521
Profile Visitors
16,626 (4 today)
Contact
Private Message
Send Now
Email
Members Only
Yahoo
garone80
CTLN7
CTLN7 friends since Aug 6, 2011
Meister_Wolo
Meister_Wolo friends since Nov 10, 2011
GazTian
GazTian friends since Dec 27, 2010
Arxae
Arxae friends since Jul 15, 2008
FJS
FJS friends since Jun 1, 2008
luke199200
luke199200 friends since Mar 1, 2010
foxatphoenixlabs
foxatphoenixlabs friends since Jul 15, 2008
ninjadave
ninjadave friends since Oct 4, 2009
TheUnknownM
TheUnknownM friends since Feb 9, 2010
TheOtherBrothers
TheOtherBrothers friends since Jul 18, 2012