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"

Is it possible to generate an error in the editor from c++?


I would like to know if it is possible to generate an error in the editor from c++ (or any other way) when certain values are set. For example, I have a door class that has:

DoorState - Either "Opened" or "Closed" IsLocked - either "True" or "False"

I would like to generate an error in the editor when the user selects "Opened" and "Locked" as this should not be a possible state for a door.

Thanks! alt text

Product Version: UE 4.21
ue4question.png (32.4 kB)
more ▼

asked Mar 23 '19 at 08:36 PM in C++ Programming

avatar image

7 1 1 2

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

1 answer: sort voted first

There CheckForErrors() function you can override:


And also IsDataValid:


Not sure about you enum states, but there a lot smoother solution, there property meta specifier called EditCondition where you put name of bool property in and it will disable the property if it's false, you can also invert this condition with ! in property name. So in your case:

 UPROPERTY(EditAnywhere, meta=(EditCondition="!IsLocked"))
 EDoorState DoorState;

And 3rd solution... is simply ignore this state and assume it open, you can also put warning in log that this state should be impossible and state will fallback to opened for example

more ▼

answered Mar 24 '19 at 12:29 AM

avatar image

37.2k 936 172 1116

avatar image Blindopoly Mar 24 '19 at 03:57 AM
 void ADoorBase::OnConstruction(const FTransform& Transform)
     // Force the door closed if it is locked
     if (IsLocked)
         DoorState = EDoorState::kClosed;
     // Set the initial state of the door
     if (DoorState == EDoorState::kClosed)

Thanks for your reply. I tried what you suggested but never got the result I wanted. I ended up doing what I posted above, where I force the DoorState to closed if it's locked in the construction script. This causes the editor value to automatically update when locked is set to true so that there is no way it can be locked and opened.

(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