Announcement

Collapse
No announcement yet.

how to cast to actor while in widget

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

    how to cast to actor while in widget

    im trying to get the object but if this doesnt work i want to be able to reference my dice spawner actor but i also cannot find a object that works for that so either way maybe yall can help me out here!

    #2
    There is a multitude of ways to pass references of objects between blueprints.

    The simplest, if you only have one of an actor type in your level is "Get all actors of class" for that class, and get element 0 from the returning array. You should do this once on begin play ( or construct), and save the reference (so you never have to do it again). This method works fine if you do it infrequently, and you are sure you only have one of the actor you're looking for (otherwise you need to determine which element to find).

    In this case, because I see you are spawning the dice spawners using your widget cameraactor_blueprint, I would recommend that the dice spawners contain a variable of type "CameraActor_Blueprint" which you should set to "Editable" and "Expose on Spawn". When you recompile everything you should see that your "Spawn Actor Dice Spawner" now has a pin for your newly created variable. If you have set it up to be of the CameraActor_Blueprint type, you should be able to plug in a "self" node to that pin. Your dice spawners now have a reference to the spawning CameraActor_Blueprint actor.


    Comment

    Working...
    X