Announcement

Collapse
No announcement yet.

Casting

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

    Casting

    Inventory class is the base class for Weapon.

    Current Inventory slot is declared in WeaponEssentialsCharacter.h

    Code:
    UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Inventory)
    		AInventory* CurrentInventorySlot;
    I have declared current ammo variable in weapon.h as:

    Code:
    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Config)
    		int32 CurrentAmmo;
    Having trouble casting in blueprints, I know how to cast in code, e.g.
    Code:
    AWeapon* Weapon = Cast<AWeapon>(CurrentInventorySlot);
    I don't understand why this isn't working.
    Click image for larger version

Name:	Untitled.png
Views:	1
Size:	487.6 KB
ID:	1144178

    #2
    Hello,
    Your "cast to weapon" exec input and output need to be connected.

    Comment


      #3
      Thanks alot. Worked perfectly once I attatched exec input to MyCharacter and output to set text.

      As a side question, why don't Widget blueprints show the 'arrows' going to and from nodes when you play the game like they do in normal blueprints?
      Last edited by Yoshimiii; 02-12-2015, 02:10 PM.

      Comment


        #4
        I am happy that helped you ^^
        I don't understand what you mean by arrows. If you could give a link or a pic of it, i could try to figure.

        Comment


          #5
          You can see how lines are pulsating when the game is being played to show it's working.

          Click image for larger version

Name:	2435-rocket_spawner_blueprint.png
Views:	1
Size:	329.7 KB
ID:	1066426

          Comment


            #6
            Oh ok, this is the debugging :
            https://docs.unrealengine.com/latest...ing/index.html I don't know why it doesn't work for umg (maybe because it needs to be set in level...)

            Comment


              #7
              Debugging works in UMG - you need to specify what instance to debug at the top, where it says Debug Filter.

              -Nick

              Comment

              Working...
              X