x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Binding text via UMG failing

So I have a random name generator that fires every time I spawn in a new enemy AI so it can assign them a random name.

The function exists in the construction graph of the enemy AI and it functions properly as I am able to print the results to the screen.

I create an AI health bar and text (for name) via UMG. I am casting in the results of the bar and it functions well. But I am binding the textfield so I can grab the randomly generated name. I am casting in the BP that holds the name and the binding function is throwing no errors. But at runtime it fails every time.

alt text

Product Version: UE 4.12
Tags:
more ▼

asked Jan 02 '17 at 05:27 PM in Blueprint Scripting

mikezteh69 gravatar image

mikezteh69
35 5 6 9

mikezteh69 gravatar image mikezteh69 Jan 02 '17 at 10:09 PM

Man this is a tough one because I have been searching the webs all day and the only thing I think I am missing is what object is not linked up in the cast...

mikezteh69 gravatar image mikezteh69 Jan 03 '17 at 03:36 AM

So I got this to work...but I am not sure it is the best practice... So let me share.

So in the bind function event I created a function that runs the name generation script and holds all the data for the names. Then in the bind I fire that event and get the variable holding the name.

I feel like this is not a clean way to do this and I would rather there be a central location for this data so the function can be used in other ways and I kind of like the data structs to be exposed the in the enemy AI class but it does function. So I would like to change my original question to - IS THIS a good way of doing this?alt text

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

The Object you are casting in "screen shot 2017-01-02 at 11.20.23 am.png" is called healthBar. So I assume it is a REF to a UMG? If so this is your error. It needs to be a REF to your enemyshipActor instead.

more ▼

answered Jan 12 '17 at 10:31 AM

Adnoh gravatar image

Adnoh
121 3 5 6

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question