Announcement

Collapse
No announcement yet.

equivalent of construction script in c++

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

    equivalent of construction script in c++

    I have a blueprint that modifies the position of a scene root on construction. How can I do something similar in c++? I can't put it in the constructor, because the variables are all set to their default values there. If I put it in BeginPlay, it works nicely, but only when I'm actually simulating / playing, not in the editor itself.

    EDIT: solved it... you just need to use

    Code:
    virtual void OnConstruction(const FTransform& Transform) OVERRIDE;
    Last edited by veggiesaurus; 04-06-2014, 04:21 PM.

    #2
    I had this issue myself when making custom components, and found "OnComponentCreated" to work. What is your extending class where you use OnConstruction?
    Unreal is to Unity as Google is to Bing

    Programming is the art of turning something logically complex into something thats simply logical

    Tutorials and helpful things of mine:
    Custom Blueprint Node Creation
    Code snippet: Blueprint Node - Create Object from Blueprint
    Code snippet: Blueprint Node - Math node

    Comment


      #3
      OnComponentCreated is called on an ActorComponent when it is first added to an Actor. OnConstruction is run on the Actor whenever it is spawned, a property changes or the Actor is moved, just like the ConstructionScript function in Blueprint-land.
      Lead Programmer - UE4 Animation/Physics/Audio Team - Epic Games
      Twitter: @EpicJamesG

      Comment


        #4
        Ah thanks - I figured that might be the case: One for Actors and the other is for ActorComps. OnConstruction would be very useful if is run every time a property is changed and I assume its in the ActorComponets since they extend actor iirc.

        (by the way technically moving is changing property - the actors location vecter :P )
        Unreal is to Unity as Google is to Bing

        Programming is the art of turning something logically complex into something thats simply logical

        Tutorials and helpful things of mine:
        Custom Blueprint Node Creation
        Code snippet: Blueprint Node - Create Object from Blueprint
        Code snippet: Blueprint Node - Math node

        Comment

        Working...
        X