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"

Using boolean logic nodes with IsValid

Hello everybody,

I'm used to programming in C# in Unity, and a certain behaviour of Unreal is really bugging me:

alt text alt text

I want to check if a variable is set, and if it is, further compare its attributes.

The problem with this setup is, that it gives me a ton of errors if TestVariable is null. Apparently it doesn't break out of the OR-node after the first condition is met.

alt text

In Unity, I often did this:

 if ((variable != null) && (variable.value == x))
 {
 //... do stuff
 }

I was expecting the boolean logic blueprint nodes to work the same way, but instead Unreal seems to always check all conditions connected to the node.

So, could somebody tell me how I can get this to work properly? Thanks!

Product Version: UE 4.13
Tags:
more ▼

asked Oct 30 '16 at 12:38 AM in Blueprint Scripting

avatar image

Yazara
3 1 3 5

avatar image ViceVersa Oct 31 '16 at 11:40 AM

the problem is that youre checking if its valid, and in the same branch checking the value. if its not valid than trying to check that value will always give you that error. instead do a branch checking isValid, then from the true part of the branch make a second branch checking the value

avatar image Yazara Oct 31 '16 at 01:15 PM

Thanks for your answer! Using two branches does works. I would prefer a solution without a branch though, to be able to use it in pure functions.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
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