Announcement

Collapse
No announcement yet.

get player character

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

    get player character

    hello.

    in my project for access a variable in "MyCharacter" from other BP i use get_player_character->cast_to MyCharacter->get var" that work ok but if i change the character and now MyCharacter its "MyCharacter2" and have the same var i going to have a problem. And going to need change all cast_to in my proyect.

    my question its, its possible made in someway avoid it.
    pd: excuse my english.

    lfw/paid modeling, painting, texturing.

    #2
    I'm not sure how they work with blueprints but in code I would use an interface for this. If that doesn't work as I'd expect I would make MyCharacter2 inherit from MyCharacter instead of the base character class. That way every MyCharacter2 would be a MyCharacter. (Though not the other way around.)

    There's a Blueprint Interface available in the New menu, so play around with that and see if you can have your character blueprints inherit from the base character class and MyCharacterInterface. If so you're done, cast to your interface and you'll be able to do anything there with anything that successfully casts. I've not yet used this myself, only noticed it in passing.

    If not then make one extend the other and cast to that.
    Last edited by Veovis Muad'dib; 08-30-2014, 07:42 AM.

    Comment


      #3
      Yes, interface is the way to go for your situation.
      In fact, try to get all your external access event/functions into interface. (ie. if this event are suppose to be called by another object, make it a interface event/function)
      This will reduce a lot of those castTo nodes, and less headach for dependency problems.
      Unreal Engine 4 Game Framework diagram for relation of all major base object types
      Unreal Engine 4 Input Event diagram, scroll down to section Input Processing Procedural
      Resident Evil Classic Camera
      RPCs official document, Must Read
      Everything you should know about replication

      Comment


        #4
        ok thanks guys.
        pd: excuse my english.

        lfw/paid modeling, painting, texturing.

        Comment

        Working...
        X