Hello! (Sorry about the title, I didn’t know what to call it…)
I’m trying to get a vbs script to load (debugging purposes.) but since StartClip is a void, not a bool, the ‘if’ statement won’t work. Is there another alternative?
the error code: ‘error CS0029: Cannot implicitly convert type void' to
bool’’
I’m making an exception handler, by the way. So if the PlayLengthLoop (The script’s name.) has (0.0f, 0.0f) as a start and end loop, the game should open the test.vbs file. (Eventually, I’ll make it so that it would load another level to prevent the Unity Editor and the built game from crashing.)
using UnityEngine;
using System.Collections;
using System.Diagnostics;
public class PlayLengthLoop : MonoBehaviour {
public AudioClip audioClip;
void Start()
{
//
StartClip(0.0f,0.0f);
}
void StartClip(float timeStart, float timeEnd)
{
audio.clip = audioClip;
audio.time = timeStart;
audio.Play();
StartCoroutine(DelaySoundStop(timeEnd));
}
IEnumerator DelaySoundStop(float timeEnd)
{
while(audio.time < timeEnd)
yield return null;
StartClip(0.0f,0.0f);
//Add your own times here !
if (StartClip(0.0f,0.0f));
System.Diagnostics.Process.Start(@"C:\Users\-----\Desktop est.vbs");
}
}