Forum begins after the advertisement:
[Part12] Regarding some operational issues in the article
Home › Forums › Video Game Tutorial Series › Creating a Metroidvania in Unity › [Part12] Regarding some operational issues in the article
- This topic has 46 replies, 4 voices, and was last updated 2 days, 20 hours ago by Terence.
-
AuthorPosts
-
December 27, 2024 at 12:48 am #16923December 27, 2024 at 1:00 am #16924::
I tried placing AudioSource under Canvas, MainMenu and other objects with UIScreen, but there was still no sound.
December 27, 2024 at 1:04 am #16925December 27, 2024 at 1:07 am #16926::I checked, when the variable only checks feedbackConfig, Null will be returned, so I should not be able to find my AudioSource
I’m curious, are sound effects and other things required to be placed under UIAudioData?
December 27, 2024 at 1:10 am #16927::If null is returned for
feedbackConfig
, it means thefeedbackConfig
object is empty no? Not the audio source.Yes, the
UIAudioFeedbackConfig
(I assuem this is what you are referring to, instead ofUIAudioData
) class is meant to simplify the assignment of sounds to UI.December 27, 2024 at 1:17 am #16928::Maybe the translation caused me to express something wrong. When I did
if (!audioSource) return;
, Null was not generated. This should mean that feedbackConfig is fine. However,if (!audioSource) return;
A Null message will be generated. I don’t know if my understanding is wrong.As for the second question, I want to ask whether I should place the sound effects and AudioMixer under the UIAudioData folder
December 27, 2024 at 1:23 am #16929::Oh, I think I found the error. I’ve been thinking that I don’t have GetComponent. Because it didn’t mark it out, I thought it wasn’t needed, but I just checked the article’s code and it has GetComponents<AudioSource>
Sorry for causing you trouble
These lines in the article
// Find an audio source in itself, or a parent object (e.g. Canvas). audioSource = GetComponentInParent<AudioSource>(); if (!audioSource && feedbackConfig) Debug.LogWarning($"No Audio Source found in parent! {name} will not have any audio feedback!");
December 27, 2024 at 2:06 pm #16933December 27, 2024 at 9:47 pm #16946::I would also like to ask which function of UIScreen is called when starting the game from the main screen. This part does not seem to be mentioned in the article.
When I created the Pause Menu and Quit To MainMenu, the picture in the article called LoadScene, but I did not have this function to call.
View post on imgur.com
December 27, 2024 at 10:11 pm #16947::Hello MI NI (mini)!
When starting a game from the main screen, the function
application(_:didFinishLaunchingWithOptions:)
in theUIApplicationDelegate
protocol is usually called. This function is part of the app delegate and is responsible for setting up your app and preparing it for use. Within this function, you can perform any necessary setup tasks, such as initializing game components and setting up the initial UI.If you have any more questions or need further clarification, feel free to ask!
December 28, 2024 at 1:18 pm #16949::@Mini copy the
UIScreen
code from the article again. I’ve added another 2 overloads to theUIScreen
script so that we can use it in the Inspector:// These are single-argument versions of the below functions, // so that buttons are able to make use of them in the editor. public virtual void LoadScene(string sceneName) { LoadScene(sceneName, -1); } public virtual void LoadScene(int buildIndex) { LoadScene(buildIndex, -1); } public virtual void LoadScene(string sceneName, float fadeDuration = -1) { LoadScene(SceneUtility.GetBuildIndexByScenePath(sceneName), fadeDuration); } public virtual void LoadScene(int buildIndex, float fadeDuration = -1) { StartCoroutine(LoadScene(buildIndex, LoadSceneMode.Single, fadeDuration)); }
December 28, 2024 at 10:00 pm #16961::I encountered a problem again. When I pressed pause, the pause menu would not appear, but it was successfully enabled. I also clicked the button, but there was no screen. When I pressed the continue game button, the pause menu would Fade in and out. Then I tested the button to exit the game, After I press the exit button, the Fader (Temp) object will not return to the main screen. It will not jump to the main menu until I press the pause menu (ESC) again.
December 28, 2024 at 10:09 pm #16963::Make sure the Time Scale Mode of both the pause and death screens are set to Nothing. Currently, it is set to Affected by Global Timescale, which causes them to be affected by game pauses.
December 29, 2024 at 6:59 pm #16971::He solved it, but when I exit to the main menu, I also need to release the pause state (ESC) before exiting to the main screen. Otherwise, the screen will still remain in the paused state.
December 29, 2024 at 7:24 pm #16972 -
AuthorPosts
- You must be logged in to reply to this topic.