Announcement

Collapse
No announcement yet.

Is casting to a BP a big performance hit?

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

    Is casting to a BP a big performance hit?

    HI!

    For some reason I thought I saw or heard on the Unreal 4 twitch streams that doing the whole "Cast to BP" node is or can be a big performance hit and should be avoided. Is this true? Or is "Cast to BP" just fine to use whenever? Thank you!

    #2
    Pretty cheap. Can't really do much without casting.

    You could do pure casting, it's faster

    Comment


      #3
      For do pure casting, just right click on the node and select "pure casting" or "convert to pure"... (you dont have the fail output) (still it can fail, but you it is not possible to provide the code to handle that case.

      Comment


        #4
        Okay awesome. Yeah I've been trying to avoid it for whatever reason and it's been making my life quite difficult. Thank you two!

        Comment


          #5
          Curious to see how casting stacks up against "Get All Actors Of Class"- I assume casting is cheaper than this node, but often when I'm trying to call a custom event from another blueprint, it seems as though it only is possible using the "Get All Actors Of Class" node.
          ARTSTATION: https://www.artstation.com/artist/noisestorm

          Comment


            #6
            There is a thread around here somewhere where someone did a massive performance test on casting and found it as fast as using any given blueprint node. You would have to do lots of casting in a very short amount of time to see an effect, but the same goes for using any blueprint node.

            Curious to see how casting stacks up against "Get All Actors Of Class"- I assume casting is cheaper than this node, but often when I'm trying to call a custom event from another blueprint, it seems as though it only is possible using the "Get All Actors Of Class" node.
            You should really only need to use it once so you can get a reference and save that to a variable. Then just reuse the variable to cast to the object.

            Get all actors of class should be pretty quick anyway, unless you are doing it a lot in a very short amount of time. Given it fills an array and then you have to access the array it is going to be slower than a straight up cast using a variable though.
            Map Generator 1.0
            Map Generator 2.0
            Map Generator 3.0

            Comment


              #7
              Originally posted by EoinOBroin View Post
              Curious to see how casting stacks up against "Get All Actors Of Class"- I assume casting is cheaper than this node, but often when I'm trying to call a custom event from another blueprint, it seems as though it only is possible using the "Get All Actors Of Class" node.
              I would imagine the performance of casting would be quite a bit more predictable since you have no real assurance how many actors would need to be evaluated when calling "get all actors o class" at runtime.
              Trevor Lee

              Comment

              Working...
              X