Always snap to grid

Difference between revisions of "UE3 talk:Actor native functions (UT3)"

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search
(Purpose of Out Variables with functions like Trace)
(No difference)

Revision as of 10:26, 28 May 2008

After talking to a trusted colleague about UnrealScript's use of out variables and why Java doesn't support them. He tells me its a bad idea because "Generally speaking out parameters are a form of pass by reference which essentially creates methods with multiple return types. There is some additional security but risks of spin-off effects exist. A preferred programming structure is to encapsulate the return types and the out variables into a new composite object."

I see some common sense in this, while working with Java, as it is slightly easier to just make a seperate private class and return that if there are multiple return types needed. With UnrealScript, I love the ability to simply create structures to do the same.

I don't neccesarilly agree with it in terms of UnrealScript though, most because I've been working for a long time and have grown acustom to it. But if what he says is slightly true, then there must be a reason why UnrealScript uses out variables Specifically for the Trace function where rather than the Hit object being returned, a HitCollision object would be returned that would hold a reference to the actual actor as well as HitLocation (or HitComponent with UT3?) etc...

The purpose for this may be memory usage and optimization but I would like input on this as its interesting to see why they would keep out variables eversince UE1. -DalinSeivewright 16:26, 28 May 2008 (UTC)