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"

How to architect game wide variable access

I am creating a game which has elements that react to sound.

I would like to have a central "engine" which does the sound-analysis, which I can then use in different actors to make them sound-reactive.

What is the best way to do this?

Right now I have an Actor BP doing the sound analysis and setting the output to a variable within that blueprint, which I then access from elsewhere, but it seems buggy, keeps leading to my project crashing.

Product Version: UE 4.19
Tags:
more ▼

asked Apr 14 '18 at 05:08 PM in Blueprint Scripting

avatar image

velvedere
1 1 1

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

2 answers: sort voted first

add to any pawn "pawn sensing component" and you will have access to hearing - so basically sound detection. you can detect sound form any source (so thrown physics objects etc) or just pawns via searching for "pawn make noise" function, or add a component called "pawn noise emitter". from my experience I can say its best to work with that you already got in engine instead of reinventing the wheel ;)

more ▼

answered Apr 14 '18 at 05:26 PM

avatar image

AngeIV
26 2 6

avatar image velvedere Apr 14 '18 at 06:28 PM

I'm detecting from the Windows Sound Card though via plugin...

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

As to your title, GameInstance is used to store variables through the game. If you need interaction in one level, you can inherit from UObject, add your sound analysis functionality to it, spawn one in a world and pass sound data to it. Or you can do it directly in GameInstance.

more ▼

answered Apr 14 '18 at 06:20 PM

avatar image

MrMcKvarz
241 2 6 15

avatar image velvedere Apr 14 '18 at 06:29 PM

OK and then within other Blueprints I would just add a reference to the GameInstance and access its variables?

avatar image Everynone Apr 14 '18 at 07:15 PM

You do not even need a direct reference. Any blueprint can GetGameInstance -> CastTo YourGameInstance.

(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