Forum begins after the advertisement:


[Part 9] UI Menu ParticleSystem not showing

Home Forums Video Game Tutorial Series Creating a Metroidvania in Unity [Part 9] UI Menu ParticleSystem not showing

Viewing 7 posts - 16 through 22 (of 22 total)
  • Author
    Posts
  • #17783
    Pool ForReal
    Level 4
    Participant
    Helpful?
    Up
    0
    ::

    okay its working thank you.but however with my option menu?

    #17784
    Pool ForReal
    Level 4
    Participant
    Helpful?
    Up
    0
    ::

    okay its working thank you.however with my option menu?

    #17785
    Ser Apustaja
    Level 5
    AI Assistant
    (BETA)
    Helpful?
    Up
    0
    ::

    I’m glad to hear that the particle system is now working! For your options menu, let’s ensure everything is functioning as intended.

    1. Menu Activation: Make sure the options menu is activated correctly when the corresponding button is clicked. Use the following code:

      public GameObject optionsMenu; // Assign this in the inspector
      
      public void OnOptionsButtonClick() {
          optionsMenu.SetActive(true);
          Debug.Log("Options Menu Activated");
      }
    2. Closing the Menu: If you want to add functionality to close the options menu, ensure you have a button that calls a method to deactivate it:

      public void CloseOptionsMenu() {
          optionsMenu.SetActive(false);
          Debug.Log("Options Menu Closed");
      }
    3. Menu Interactions: Ensure the buttons inside the options menu are set up correctly. They should have their onClick events assigned to the functions that handle their specific actions (e.g., adjusting settings, returning to the main menu).

    4. UI Elements: If you have sliders, toggles, or dropdowns in the options menu, make sure they are set up to update the relevant settings properly. For example, if you have a volume slider:

      public void SetVolume(float volume) {
          AudioListener.volume = volume;
          Debug.Log("Volume set to: " + volume);
      }
    5. Debugging: If the options menu isn’t working as expected, add Debug.Log statements at key points in your code to track what’s happening when you attempt to interact with it.

    If you can specify what isn’t working with the options menu or what features you want to implement, I can provide more targeted assistance!

    #17786
    Pool ForReal
    Level 4
    Participant
    Helpful?
    Up
    0
    ::

    I use FadeUI script likes the video this my script

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    
    public class FadeUI : MonoBehaviour
    {
        CanvasGroup canvasGroup;
    
        private void Awake()
        {
            canvasGroup = GetComponent<CanvasGroup>();
        }
    
        public void FadeUIOut(float _seconds)
        {
            StartCoroutine(FadeOut(_seconds));
        }
        public void FadeUIIn(float _seconds)
        {
            StartCoroutine(FadeIn(_seconds));
        }
    
        IEnumerator FadeOut(float _seconds)
        {
    
            canvasGroup.interactable = false;
            canvasGroup.blocksRaycasts = false;
            canvasGroup.alpha = 1;
            while (canvasGroup.alpha > 0)
            {
                canvasGroup.alpha -= Time.unscaledDeltaTime / _seconds;
                yield return null;
            }
            yield return null;
        }
    
        IEnumerator FadeIn(float _seconds)
        {
            canvasGroup.alpha = 0;
            while (canvasGroup.alpha < 0)
            {
                canvasGroup.alpha += Time.unscaledDeltaTime / _seconds;
                yield return null;
            }
            canvasGroup.interactable = true;
            canvasGroup.blocksRaycasts = true;
            yield return null;
        }
        // Start is called before the first frame update
        void Start()
        {
    
        }
    
        // Update is called once per frame
        void Update()
        {
    
        }
    }
    
    #17787
    Ser Apustaja
    Level 5
    AI Assistant
    (BETA)
    Helpful?
    Up
    1
    ::

    It looks like there are a couple of issues in your FadeUI script that might be causing problems with the fade-in functionality. Specifically, in the FadeIn coroutine, the condition in the while loop should check if canvasGroup.alpha is less than 1, not less than 0. Here’s the corrected version of your FadeIn method:

    IEnumerator FadeIn(float _seconds)
    {
        canvasGroup.alpha = 0;
        while (canvasGroup.alpha < 1) // Change this condition
        {
            canvasGroup.alpha += Time.unscaledDeltaTime / _seconds;
            yield return null;
        }
        canvasGroup.interactable = true;
        canvasGroup.blocksRaycasts = true;
        yield return null;
    }

    Make sure to update that condition, and it should work as expected.

    If you have any further questions or if there's something specific that isn't working with the fade effects, please let me know!

      1 anonymous person
    has upvoted this post.
    #17790
    Pool ForReal
    Level 4
    Participant
    Helpful?
    Up
    0
    ::

    okay its working.thank you

    #17791
    Ser Apustaja
    Level 5
    AI Assistant
    (BETA)
    Helpful?
    Up
    1
    ::

    You’re welcome! I’m glad to hear everything is working. If you have any more questions or need further assistance with your game development, feel free to ask. Is there anything specific you would like help with next?

      1 anonymous person
    has upvoted this post.
Viewing 7 posts - 16 through 22 (of 22 total)
  • You must be logged in to reply to this topic.

Go to Login Page →


Advertisement below: