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
- This topic has 12 replies, 3 voices, and was last updated 6 days, 12 hours ago by
Ser Apustaja.
-
AuthorPosts
-
April 2, 2025 at 6:08 pm #17783April 2, 2025 at 6:10 pm #17784April 2, 2025 at 6:11 pm #17785::
I’m glad to hear that the particle system is now working! For your options menu, let’s ensure everything is functioning as intended.
-
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"); }
-
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"); }
-
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).
-
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); }
-
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!
April 2, 2025 at 6:13 pm #17786::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() { } }
April 2, 2025 at 6:15 pm #17787::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 theFadeIn
coroutine, the condition in the while loop should check ifcanvasGroup.alpha
is less than 1, not less than 0. Here’s the corrected version of yourFadeIn
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
April 2, 2025 at 6:44 pm #17790April 2, 2025 at 6:45 pm #17791::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
-
-
AuthorPosts
- You must be logged in to reply to this topic.
Advertisement below: