File tree Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -223,6 +223,7 @@ MonoBehaviour:
223
223
m_Script : {fileID: 11500000, guid: 0896d1324347bd349886948e2acc0cbe, type: 3}
224
224
m_Name :
225
225
m_EditorClassIdentifier :
226
+ sayAtStart : Welcome!
226
227
--- !u!4 &548749181
227
228
Transform :
228
229
m_ObjectHideFlags : 0
@@ -290,6 +291,7 @@ MonoBehaviour:
290
291
m_Script : {fileID: 11500000, guid: 8b7423e13850ebd41a515edd899b7985, type: 3}
291
292
m_Name :
292
293
m_EditorClassIdentifier :
294
+ voiceID : Tweaky
293
295
--- !u!4 &1665498523
294
296
Transform :
295
297
m_ObjectHideFlags : 0
Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ namespace UnityLibrary
12
12
[ DefaultExecutionOrder ( - 100 ) ]
13
13
public class Speech : MonoBehaviour
14
14
{
15
+ public string voiceID = "Tweaky" ;
16
+
15
17
// singleton isntance
16
18
public static Speech instance ;
17
19
@@ -30,7 +32,6 @@ void Awake()
30
32
Client . Initialize ( datafolder ) ;
31
33
32
34
// select voice
33
- string voiceID = "Tweaky" ;
34
35
var setvoice = Client . SetVoiceByName ( voiceID ) ;
35
36
if ( setvoice == false ) Debug . Log ( "Failed settings voice: " + voiceID ) ;
36
37
@@ -71,10 +72,10 @@ void SpeakerThread()
71
72
// adds string to TTS queue
72
73
public void Say ( string msg )
73
74
{
74
- if ( isClosing == false && isRunning == true )
75
- {
76
- messages . Enqueue ( msg ) ;
77
- }
75
+ if ( isClosing == true || isRunning == false ) return ;
76
+ if ( string . IsNullOrEmpty ( msg ) ) return ;
77
+
78
+ messages . Enqueue ( msg ) ;
78
79
}
79
80
80
81
private void OnDestroy ( )
Original file line number Diff line number Diff line change 3
3
4
4
public class TestSpeech : MonoBehaviour
5
5
{
6
+ public string sayAtStart = "Welcome!" ;
7
+
6
8
// Start is called before the first frame update
7
9
void Start ( )
8
10
{
9
11
// TEST speech
10
- Speech . instance . Say ( "Welcome!" ) ;
12
+ Speech . instance . Say ( sayAtStart ) ;
11
13
}
12
14
13
15
// Update is called once per frame
You can’t perform that action at this time.
0 commit comments