[Tutorial] Custom Hint Fader with Screen Text
First thing you're going to want to do is add a screen text
Then you want to add a script in your resources
Now in the script you want to press CTRL/CMD + A and then press backspace to delete all the text that is already in there, now you're going to paste this code
// @input int delayDuration = 5 {"widget":"slider", "min":0, "max":10, "step":1}
var canFade = false;
var delayedEvent = script.createEvent("DelayedCallbackEvent");
delayedEvent.bind(function () {
canFade = true
});
delayedEvent.reset(script.delayDuration);
script.createEvent("UpdateEvent").bind(function () {
var hintText = script.getSceneObject().getComponent("Component.Text");
var currentTextColor = hintText.textFill.color;
var currentTextStrokeColor = hintText.outlineSettings.fill.color;
if (canFade) {
hintText.textFill.color = new vec4(currentTextColor.x, currentTextColor.y, currentTextColor.z, (currentTextColor.w - 0.1));
hintText.outlineSettings.fill.color = new vec4(currentTextStrokeColor.x, currentTextStrokeColor.y, currentTextStrokeColor.z, (currentTextStrokeColor.w - 0.1));
}
});
Once that's pasted you're going to go back to your screen text and click it. Then press "Add Component"
Now press Script
Now press the button that says add script. You now need to select the script you just created and press ok. now you can change the delay duration. If you want it to be just like a Hint then set it to 1 second. I suggest around 2 seconds so the user can read the text.
I hope this helps,
- Shawn
Thanks
Thanks alot :D
Thanks for helping <3