A
A
ase20152019-04-19 19:38:58
C++ / C#
ase2015, 2019-04-19 19:38:58

I'm trying to make a loading scene and it gives me an error, what should I do?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;

public class loading : MonoBehaviour
{
    public int SceneID;
    // Start is called before the first frame update
    void Start()
    {
        StartCoroutine(AsyncLoad());
    }

    IEnumerator AsyncLoad()
    {
        AsyncOperation operation = SceneManager.LoadSceneAsync(SceneID);
    }
}

unit error:
Assets\Scripts\loading.cs(16,17): error CS0161: 'loading.AsyncLoad()': not all code paths return a value

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
Troodi Larson, 2019-04-19
@ase2015

I have been working in C# for a long time, but as far as I can see, IEnumerator AsyncLoad() has a specific type, which means that a value should be returned, or try to make it void.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question