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"

Use Custom Game State

hello i am doing a game state for my project( example: start menu , level select , level1,level2 etc) and i have been using a simple string and in the function checking to see if the string is equal to startmenu or levelselect etc.i have looked online for a more proper way of doing this and i cam across enums. some sources say use namespace with enum Type and some say use enum class. which method is better for simply checking and setting a state. and how would i check/set the enum to a particular value. I have tried the enum class method however cannot change between them.

Product Version: UE 4.10
Tags:
more ▼

asked Dec 25 '15 at 07:34 PM in C++ Programming

avatar image

Problemahtic
52 18 16 19

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

1 answer: sort voted first

They're both valid methods and just as easy. The enum class is the more up to date method.

Alternately, instead of using a string in a function, you can check GetWorld()->GetName() - that will return the name of the map.

more ▼

answered Dec 25 '15 at 07:48 PM

avatar image

TTaM
1.7k 81 28 81

avatar image Problemahtic Dec 25 '15 at 08:26 PM

so if i am using the enum class method can i actually have one of the values = true and the rest = false and switch it up when i need?

avatar image TTaM Dec 25 '15 at 08:32 PM

No. Enum values can't change. You need to compare them to something. you can do MyEnumVar == MyEnum::Blah to get true/false. But you need that MyEnum::Blah to compare it to.

Another method would be to change the game mode for each map (in the world settings.) You can override any methods you need to change or override variable values, etc.

(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