I am currently working on a project on school and have been loosely following an old YouTube tutorial. however my unity keeps crashing . it seems that this code is the issue. could anyone help me with this please?
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class DisplayScene : MonoBehaviour
{ public int Scene;
public int scene
{
get { return scene; }
set { scene = value;
// although it is unecessary to define this i have added it so i can see what i have done
if (value == 3)
scene = 1;
else if (value == 0)
scene = 2;
else
scene = value;
}
}
private int previousScene;
void Start()
{
previousScene = 0;
scene = 1;
}
void update()
{
if(scene != previousScene)
{
GetComponent().sprite = Resources.Load("Sprites/scene" +
Scene.ToString());
}
previousScene = scene;
}
}
↧