Announcement

Collapse
No announcement yet.

Make Cast node be pure by default

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Make Cast node be pure by default

    As I'm starting to use BP more and more, one of the things that annoys me is the cast nodes. They are very bulky. I'm starting to cache these on BeginPlay when I need them a lot, but a lot of times you just need them for one shot things and it just makes the BP more confusing, forcing connections to cross more. Here's an example:
    Click image for larger version

Name:	Screen Shot 2015-03-06 at 18.55.00.png
Views:	1
Size:	110.4 KB
ID:	1145350

    And now with the casts converted to pure casts:
    Click image for larger version

Name:	Screen Shot 2015-03-06 at 18.53.39.png
Views:	1
Size:	104.2 KB
ID:	1145351

    IMO the default mode of a cast should be pure, and not the impure one.

    Regards,
    Nuno Afonso
    http://www.fluxeditor.com
    Last edited by nafonso; 03-06-2015, 03:03 PM.

    #2
    I think the reason this ISN'T done this way is that a pure cast will require the engine to re-perform the cast every time you do something new with it (pure functions in UE4 get re-calculated everytime the execution path needs the output; impure functions are executed when they're called and the output is cached or whatever and can be reused)

    But I agree, as it's very rare that I need to Cast To something for more than one operation (function call, get, etc) since I usually just build the necessary functionality encapsulated in a function or connected to a custom event and call it once (so if ApplyDamage also needs to call DamageReaction, I just do that on the target as part of ApplyDamage's execution, rather than via cast calling two functions)

    Comment


      #3
      The caching seems odd, because a lot of times you're passing different objects to those nodes. Maybe it does cache them, but I would doubt it. Maybe somebody can shed some light on it?

      Regards,
      Nuno Afonso
      http://wwww.fluxeditor.com

      Comment

      Working...
      X