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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Can't access boolean value from another actor component.

Hello. So I have 2 actor components on my first person character. On component1 I have various functions and variables. On component2 I wish to access the value of a Boolean on component1. I have tried this, but the value of the bool always stays false (the bool value is 100% changing):

 //In the tick function    
 if (myCharacter->WallRunMechanicComponent->isWallRunning == true)
     {
         UE_LOG(LogTemp, Warning, TEXT("WALL RUNNING!"));
     }
     else
     {
         UE_LOG(LogTemp, Warning, TEXT("NOT WALL RUNNING!"));
     }
 

I don't understand why this is not working because in the same component class if I call one of the functions from component1 everything works fine:

 myCharacter->WallRunMechanicComponent->stopWallRun(); //Works and stops the character from wall running.


Now I could get around this by having a bool on myCharacter that changes everytime the one on component1 does, then read this from component2, but I'd prefer not too and keep everything organised. Also this is just really bugging me! Thanks to anyone that can help!

Product Version: UE 4.14
Tags:
more ▼

asked Feb 16 '17 at 10:29 PM in C++ Programming

avatar image

MatthewRandle
6 1 1

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

1 answer: sort voted first

Never mind I was just being really stupid. Turns out I have 2 variables in my component1 that are called wallRunning and isWallRunning for some reason. The isWallRunning was never used in the class so when I was ready the value it was true that it was always false.

more ▼

answered Feb 16 '17 at 10:43 PM

avatar image

MatthewRandle
6 1 1

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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