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"

Code compiles in Visual Studio, but the changes are not reflected in the editor

I am having a lot of trouble trying to figure out what my problem is. My code compiles successfully within Visual Studio, but the changes that I make to my code are not appearing in-editor. For example, I changed some of my variables from the uproperty VisibleAnywhere to EditAnywhere, but in the editor they are still showing up as greyed-out boxes that I cannot change (I had heard hot reload is finicky with header files). I also added an OnClicked function to a skeletal mesh, but this function is not being called when I do click on the skeletal mesh, and I have a feeling it is due to the changes in code not being reflected in the editor. I have tried deleting the visual studio project file, the intermediate folder, the binary folder. I tried opening visual studio from the editor after generating project files, but that didn't work either. I have even cloned the repository from github hoping that it would fix the issue, but it did not. I am not sure if this is a hot reload issue, but any help would be greatly appreciated.

edit: So on second look at my code, I determined why the editor was not updating the variables I changed, and it was simply because I declared an instance of the struct containing those variables with VisibleAnywhere, so of course they would not be editable. But, I am still having difficulty with the clicked events. The definition of the function in my .h file is this:

     UFUNCTION()
     void OnClicked(UPrimitiveComponent* ClickedComponent, FKey ButtonPressed);

And in the constructor in the .cpp file,

 UnitSkeletalMesh->OnClicked.AddDynamic(this, &AUnitBase::OnClicked);

And the actual function:

 void AUnitBase::OnClicked(UPrimitiveComponent* ClickedComponent, FKey ButtonPressed)
 {
     UE_LOG(LogTemp, Warning, TEXT("In OnClicked."));
 }

Any help with this problem is very welcome.

Product Version: UE 4.19
Tags:
more ▼

asked Jul 09 '18 at 07:19 PM in C++ Programming

avatar image

JSwidinsky
3 1 2

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

2 answers: sort voted first

Solution: Make sure you have collision enabled on your mesh for onClick events otherwise your onClick event will not fire as your mouse click will not see your mesh :)

more ▼

answered Jul 09 '18 at 09:46 PM

avatar image

Daxter154
116 1 3 4

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

This may seem like a stupid question, but did you press the compile button in UE4? I used to have the same problem when I would compile in VS17 instead of with the in-editor button.

more ▼

answered Jul 09 '18 at 07:43 PM

avatar image

Daxter154
116 1 3 4

avatar image JSwidinsky Jul 09 '18 at 07:52 PM

Yeah, I tried the compile button in the editor as well, but that didn't update the code for some reason.

avatar image Daxter154 Jul 09 '18 at 07:57 PM

Would be helpful to see code.

avatar image Daxter154 Jul 09 '18 at 09:18 PM

Relating to the skeletal meshes problem. Does your mesh have collision enabled?

See This Thread

avatar image JSwidinsky Jul 09 '18 at 09:43 PM

Wow, so that was my problem, not visual studio like I thought. Thanks a lot for that reference and your help.

(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