Warning: Cannot modify header information - headers already sent by (output started at /homepages/25/d169645162/htdocs/index.php:1) in /homepages/25/d169645162/htdocs/wp-includes/feed-rss2-comments.php on line 8
Comments on: Unity3D: the editor/code duality http://www.zedia.net/2013/unity3d-the-editorcode-duality/ Flash, ActionScript, SEO and everything in between Tue, 25 Feb 2014 02:22:55 +0000 hourly 1 http://wordpress.org/?v=3.6.1 By: Mario R http://www.zedia.net/2013/unity3d-the-editorcode-duality/comment-page-1/#comment-106704 Mario R Tue, 07 Jan 2014 21:16:03 +0000 http://www.zedia.net/?p=964#comment-106704 Hey, I’ve been looking through your shader for masking in ngui, I wonder if you have come accross the need to have an ngui panel clipping a 3d mesh, I’ve been trying to do so for a few days and looks like it’s beyond me, any advice on how to achieve this?

]]>
By: sebbe selvig http://www.zedia.net/2013/unity3d-the-editorcode-duality/comment-page-1/#comment-91932 sebbe selvig Tue, 25 Jun 2013 07:56:54 +0000 http://www.zedia.net/?p=964#comment-91932 I think the component way of Unity is really great, but it takes some time to wrap your head around. Of cause you can manipulate the components directly from components attached to other GameObjects, but that will soon give you headaches!

Bear in mind that Unity primary focus is 3D, so most intensive interaction would be 3D collision events and keyboard/controller input. Other loosely coupled events can be done through SendMessage, SendMessageUpwards and BroadcastMessage. The functions takes the function name as a string an will call it on applicable components attached to the GameObjects. It’s slower than direct function calls, but it’s not meant to be used for logic that is called every frame.

To work around the “problem” you point out, you could look into the decorator pattern.

var obj2d = new Object2D(gameObject);
obj2d.x = 30;

The above would have an setter like this:
float x {
set {
contextGO.tranform.localPosition = new Vector3d (30, contextGO.tranform.localPosition.y, contextGO.tranform.localPosition.z);
}
get { return contextGO.tranform.localPosition.x; }
}

where contextGO is the gameObject you pass in the constructor.

Also you could use the cool extension methods available in the C# sharp language that enables you to attach new methods to existing classes like so:

public static class MyExtensions {
public static void MyExtendedMethod(this GameObject gameObject) {
// Do something
}
}

But it definitely would be cool to be able to specify what class unity should use as the class for GameObjects.

]]>
By: jack http://www.zedia.net/2013/unity3d-the-editorcode-duality/comment-page-1/#comment-91901 jack Mon, 24 Jun 2013 10:49:59 +0000 http://www.zedia.net/?p=964#comment-91901 @ zedia.net
you are right, you don’t know it, but i am sure it’s possible to deal with this situation

you can design the app the way you know what component is on what gameobject like using tags

or you can parse all gameobject by function which will separate them to groups by components

as i wrote on serious stuff i am using prefabs with one component only and for me prefab means the particular component and it’s gameobject is only shell; i use extending like monobehaviour > entity > movingentity > enemy > soldier and it works well for me

]]>
By: Mark Mandel http://www.zedia.net/2013/unity3d-the-editorcode-duality/comment-page-1/#comment-91676 Mark Mandel Fri, 21 Jun 2013 01:26:29 +0000 http://www.zedia.net/?p=964#comment-91676 Preface: I’ve not worked with Unity3d.

From what I’ve read (http://en.wikipedia.org/wiki/Entity_component_system) Unity3d is based on an Entity System Component architecture. This is quite different from standard OO practices, and is quite likely what is causing you so much consternation.

I would suggest starting at: http://entity-systems.wikidot.com/

Which gives a good overview (and code samples if I remember correctly) on ES architectures and why people use them for gaming.

I hope that helps!

]]>
By: zedia.net http://www.zedia.net/2013/unity3d-the-editorcode-duality/comment-page-1/#comment-91609 zedia.net Wed, 19 Jun 2013 22:13:12 +0000 http://www.zedia.net/?p=964#comment-91609 @jack Well I wrote this so that someone could prove me wrong. I want to learn the right way to do things.

Anyway, here is a thing, if you instantiate a prefab, or if you Resource.load it, you get a reference to the gameObject. Now you have to GetComponent the script attached to it, but you don’t know its name or if it exists at all. That is really weird to me.

]]>
By: jack http://www.zedia.net/2013/unity3d-the-editorcode-duality/comment-page-1/#comment-91604 jack Wed, 19 Jun 2013 20:09:50 +0000 http://www.zedia.net/?p=964#comment-91604 well in my projects i usually have only one gameobject as mainloop and all other important model / controller stuff is not component added to gamebobject unless it’s direct controller for particular gameobject and i mostly use prefabs atm

gameobject (except the mainloop) for me is view only

ofcourse u can’t extend gameobject, but u can extend component and i don’t make lists of gameobject, cause it’s ridiculous to call GetComponent all the time, i make lists of the components and there u can extend the functionality to x, y, depth of course

etc. this article is complete misunderstanging of unity at general … and btw i was working in flash very long time and yes it wasn’t easy to switch to unity but i love that, cause flash sucks :D

]]>