scrolling canvas script on scene wont play the second time scene is loaded.
I made a script that is supposed to make my credits canvas slowly scroll up. The script works in the editor and when i test it by exporting the credits scene.
I just exported the game for release and found out that if you try to play the credits scene after returning to the main menu it wont do anything, but if you run the credits scene before hitting play in the main menu it will work fine. That probably did not make much sense so I will upload a video to youtube to show you what happens. If you know what is wrong please tell me. (the script is attached to a gameobject btw).
Here is the script:
using UnityEngine;
using System.Collections;
public class ScrollCredits : MonoBehaviour
{
public GameObject Canvas;
public int speed = 1;
public string level;
private void Update()
{
Canvas.transform.Translate(Vector3.up * Time.deltaTime * speed);
StartCoroutine(waitFor());
}
IEnumerator waitFor()
{
yield return new WaitForSeconds (69);
Application.LoadLevel(level);
}
}
Your answer
![](https://koobas.hobune.stream/wayback/20220612204515im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Destroy object when a new scene loads 0 Answers
Scripted GameObjects vs Prefabs 0 Answers
Is it safe to instantiate a GameObject and then change it's components? 1 Answer
I need quick help with my C# code GetComponent! 1 Answer
How to attach a GameObject to a Prefab that has many scripts attached? 0 Answers