OK this issues has been plaguing me for what feels like forever and no one seems to explain right what I need to do to fix the issue.
I have a game object that when my scene changes it looses connection to items in the inspector when I return to the scene. I have tried this:
I added a video demo link to try and better explain what I mean. There must be a way of dealing with this issue?
// Use this for initialization
void Start () {
StartCoroutine(OpenConnection());
lightSlider = GetComponent<Slider> ();
if(slider == null) slider = GetComponent<Slider>(); // search slider in this object if its not set in unity inspector
if(source == null) source = FindObjectOfType<VoiceBox>().GetComponent<AudioSource>(); // search audiosource in this object if its not set in unity inspector
}
Tos see if I could get the start function to re - assign the Audio course into the inspector but it does nothing when I return to my main scene.
Here is a link to a demo video of what I mean
Video Demo