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

Viewing 15 posts - 16 through 30 (of 48 total)
  • Author
    Posts
  • #16923
    Terence
    Level 30
    Keymaster
    Helpful?
    Up
    0
    ::

    I put it under the Canvas that contains my UI Screen.

    #16924
    MI NI
    Level 15
    Bronze Supporter (Patron)
    Helpful?
    Up
    0
    ::

    I tried placing AudioSource under Canvas, MainMenu and other objects with UIScreen, but there was still no sound.

    #16925
    Terence
    Level 30
    Keymaster
    Helpful?
    Up
    0
    ::

    Check both the audioSource and feedbackConfig variables. Are either of them null?

    #16926
    MI NI
    Level 15
    Bronze Supporter (Patron)
    Helpful?
    Up
    0
    ::

    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?

    #16927
    Terence
    Level 30
    Keymaster
    Helpful?
    Up
    0
    ::

    If null is returned for feedbackConfig, it means the feedbackConfig object is empty no? Not the audio source.

    Yes, the UIAudioFeedbackConfig (I assuem this is what you are referring to, instead of UIAudioData) class is meant to simplify the assignment of sounds to UI.

    #16928
    MI NI
    Level 15
    Bronze Supporter (Patron)
    Helpful?
    Up
    0
    ::

    Maybe the translation caused me to express something wrong. When I didif (!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

    #16929
    MI NI
    Level 15
    Bronze Supporter (Patron)
    Helpful?
    Up
    0
    ::

    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!");
    #16933
    Terence
    Level 30
    Keymaster
    Helpful?
    Up
    0
    ::

    Glad you found the issue @mini

    #16946
    MI NI
    Level 15
    Bronze Supporter (Patron)
    Helpful?
    Up
    0
    ::

    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
    #16947
    Ser Apustaja
    Level 1
    AI Assistant
    (BETA)
    Helpful?
    Up
    0
    ::

    Hello MI NI (mini)!

    When starting a game from the main screen, the function application(_:didFinishLaunchingWithOptions:) in the UIApplicationDelegate 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!

    #16949
    Terence
    Level 30
    Keymaster
    Helpful?
    Up
    0
    ::

    @Mini copy the UIScreen code from the article again. I’ve added another 2 overloads to the UIScreen 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));
    }
    #16961
    MI NI
    Level 15
    Bronze Supporter (Patron)
    Helpful?
    Up
    0
    ::

    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.

    #16963
    Terence
    Level 30
    Keymaster
    Helpful?
    Up
    0
    ::

    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.

    #16971
    MI NI
    Level 15
    Bronze Supporter (Patron)
    Helpful?
    Up
    0
    ::

    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.

    #16972
    Terence
    Level 30
    Keymaster
    Helpful?
    Up
    0
    ::

    @Mini in this case, you can add an unpause action (GameManager > Pause with unchecked checkmark) to your quit to main menu button as well. The unpause action will cause time to go back to normal.

Viewing 15 posts - 16 through 30 (of 48 total)
  • You must be logged in to reply to this topic.

Go to Login Page →


Advertisement below: