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"

Is it a good idea to have one main master variable class for actors?

hey guys!

I am incredibly new to C++ and UE4 and was wondering: what is the best way to handle variables in a project?

I was thinking it might be a good idea to have a class full of variables where everything important is stored in the one place.

Think about a UE4 map, every object is stored in the map with details on where it is and how it is positioned, every object accesses that main 'master file' (the map) and gets information about where it's suppose to be (or the map tells objects, rather than objects querying for information). I was wondering if it is efficient (or even a remotely good idea) to have the same approach with variables; to have a 'master' class full of all important variables for objects/actors so that everything is stored in the one place and relatively easy to get to or reference.

Is this a good idea or does it just create unnecessary references in memory? Is this even good practice or am I thinking in an out-of-date fashion?

Any improvements on the way I'm thinking are extremely welcomed, Thanks guys!

Product Version: Not Selected
Tags:
more ▼

asked Sep 27 '14 at 01:37 AM in C++ Programming

avatar image

blindman457
29 7 8 12

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

Hi blindman457,

In general, you want to have your variables limited to the scope where they are required. So variables that are only used by one class are included in that class. If the information needs to be accessed occasionally by another class, you can create a Get function to enable the other class to retrieve the current value of the variable (and a Set function, if necessary).

more ▼

answered Sep 30 '14 at 07:52 PM

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