I want to control textScrollSpeed from inside the actual test, like so:
<50>these chars will be printed with 50 speed. <100> these chars will be printed with 100 speed
(to get a ace attorney like text speed control)
The way I think of now involves accessing a private prop, so there must be another way:
I was thinking about creating a custom action extending ActionList, then in its run
method read the tags from protected Speech speech
and control the textScrollSpeed,
the problem is that speech.currentCharIndex
is private.
Can you give me a hint of how to do this otherwise?
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Welcome to the community, @eran.
This is a good case for the use of "speech event tokens" - see the Manual chapter of the same name, which provides details and examples.
To change the value of any Manager field through script, right-click that field's label and select "Copy script variable". In the case of the Speech Manager's "Text scroll speed" field, it's:
With a speech event token, you could modify this in your speech text with e.g.:
[textspeed:50]these chars will be printed with 50 speed. [textspeed:100] these chars will be printed with 100 speed
Hello!
I wanted to do this thing, here is the code I wrote. Seems to work?
`
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using AC;
public class SpeechTokenMonitor : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
`
I placed this script on the game Engine Object, I also wrote this other Script on the subtitles UI Prefab so that the Scroll speed would rest after every line
`using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using AC;
public class TextScrollDefaults : MonoBehaviour
{
public float TextScrollSpeed = 90;
// Start is called before the first frame update
void Start()
{
}`
Looks good - but you'll need to check the value of "tokenKey" before parsing it, so that you don't run the code for other tokens, e.g. [wait].
Ahh, good catch, thank you!