Forum begins after the advertisement:
-
::Hi Ethan, you need to change the SceneFader
script’s Start()
function to Awake()
:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class SceneFader : MonoBehaviour
{
[SerializeField] private float fadeTime;
private Image fadeOutUIImage;
public enum FadeDirection
{
In,
Out
}
// Start is called before the first frame update
void Start() Awake()
{
fadeOutUIImage = GetComponent<Image>();
}
...
::Can you show me your UIManager
script? If you can show this in text, it will be great.
::using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class UIManager : MonoBehaviour
{
public static UIManager Instance;
private void Awake()
{
if (Instance != null && Instance != this)
{
Destroy(gameObject);
}
else
{
Instance = this;
}
DontDestroyOnLoad(gameObject);
}
public SceneFader sceneFader;
private void Start()
{
sceneFader = GetComponentInChildren<SceneFader>();
}
}
::Can you add this above line 25 of your SceneTransition
as well? I’m checking if either UIManager.Instance
or UIManager.Instance.sceneFader
is the null value.
print(UIManager.Instance);
print(UIManager.Instance.sceneFader);
Show me the output on the Console after that.
::Try moving the sceneFader
up to Awake()
:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class UIManager : MonoBehaviour
{
public static UIManager Instance;
private void Awake()
{
if (Instance != null && Instance != this)
{
Destroy(gameObject);
}
else
{
Instance = this;
}
DontDestroyOnLoad(gameObject);
sceneFader = GetComponentInChildren<SceneFader>();
}
public SceneFader sceneFader;
private void Start()
{
sceneFader = GetComponentInChildren<SceneFader>();
}
}
::thank you it function now
::but now when my character healing, it will always stuck at the player_heal animation
::and also When I am in the part4 tutorial, after my character healing finish, it will cast the fireball at the same time
::and also when the player is transitioned to another scene the mana UI is being filled
Advertisement below: