Announcement

Collapse
No announcement yet.

How to pull variables from other blueprints using Overlap Events?

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

    How to pull variables from other blueprints using Overlap Events?

    I have two blueprints: PlayerBP and EnemyBP.

    Both blueprints are of the Paper2D.PaperCharacter class.

    I'm using the blueprint below on my player in attempts to determine if the object I'm colliding with is an enemy or not. When I do collide with the enemy blueprint (which was drag and dropped onto the level) I get a returned value of "cast failed".

    The variable "Enemy Type" resides within the EnemyBP blueprint, and is NOT set to private. I've looked over a couple documents but I'm not quite sure what I'm missing.
    Click image for larger version

Name:	blueprint.png
Views:	1
Size:	101.2 KB
ID:	1144608

    Unpopular Minion on the Play Store (Released: January 31, 2016)

    #2
    What if you drop the character by itself in the level, does it still return cast failed? It will always fail the cast if it overlaps anything besides the specified BP.

    Comment


      #3
      Originally posted by The Britain View Post
      What if you drop the character by itself in the level, does it still return cast failed? It will always fail the cast if it overlaps anything besides the specified BP.
      Turns out the issue was with common sense not the blueprint. I had dropped a sprite down for the enemy instead of the blueprint itself.

      Just in case another comes across a similar issue here are the steps I took to make this work:

      1) Generate OnOverlap Event for the player's Sprite (or capsule, whatever you choose).
      2) Created the Player Blueprint shown (PlayerBP).
      3) Within the Enemy Blueprint (EnemyBP) I set variable "EnemyType" to private and exposed (made public) a function (Return Enemy Type) public which returns the value of EnemyType.
      Click image for larger version

Name:	finished_working.jpg
Views:	1
Size:	113.1 KB
ID:	1066900

      Not sure if this is the Unreal Engine way but I'd rather expose a function than a variable for readability reasons.

      Unpopular Minion on the Play Store (Released: January 31, 2016)

      Comment

      Working...
      X