Announcement

Collapse
No announcement yet.

static functions callable from both c++ and blueprints

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

    static functions callable from both c++ and blueprints

    Hi,

    I have 2 c++ classes : A and B

    I have 2 blueprints A_BP who inherits from A, and B_BP who inherits from B

    I'd like to create a c++ class "MyMaths" whose every functions are statics and can be used in both my c++ classes and my blueprints

    How to do so please ?

    #2
    Blueprints can use static Ufunctions
    Code:
    public :
    
    UFUNCTION (BlueprintCallable)
    static MyFunc(...);
    | Savior | USQLite | FSM | Object Pool | Sound Occlusion | Property Transfer | Magic Nodes | MORE |

    Comment


      #3
      thanks Bruno, and when creating my new class "MyMaths", which class should be its parent ? I have to define a parent class, should i chose "None" ?

      Comment


        #4
        You can use "Blueprint Function Library" class for that. Any subclass of "UObject" can do it, but since Epic added a FunctionLibrary class for that, why not use it..
        | Savior | USQLite | FSM | Object Pool | Sound Occlusion | Property Transfer | Magic Nodes | MORE |

        Comment


          #5
          Thank you so much

          Comment


            #6
            Originally posted by BrUnO XaVIeR View Post
            You can use "Blueprint Function Library" class for that. Any subclass of "UObject" can do it, but since Epic added a FunctionLibrary class for that, why not use it..
            Can i call any of these "Blueprint Function Library" functions from a another c++ class ? Or these can only be called from blueprints ?

            Comment


              #7
              Yes, just include its headers to use them in Cpp
              | Savior | USQLite | FSM | Object Pool | Sound Occlusion | Property Transfer | Magic Nodes | MORE |

              Comment


                #8
                This is awesome. Thanks again Bruno

                Comment

                Working...
                X