Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Copyright (c) 2019-2021 Kai Clavier [kaiclavier.com] Do Not Distribute
- using UnityEngine;
- using System.Collections;
- using UnityEngine.Events;
- using Fleece;
- [ExecuteInEditMode] //this is needed for OnValidate to work
- public class STMJumper : MonoBehaviour, IJumperValidateable
- {
- private SuperTextMesh stm;
- public Jumper jumper;
- void Awake()
- {
- stm = GetComponent<SuperTextMesh>();
- }
- public void OnEnable()
- {
- ValidateJumper();
- }
- private bool validate = false;
- public void OnValidate()
- {
- validate = true;
- }
- public void Update()
- {
- if(!Application.isPlaying && validate)
- {
- validate = false;
- ValidateJumper();
- }
- }
- public void ValidateJumper()
- {
- if(jumper != null && jumper.passage != null && stm != null)
- {
- stm.text = jumper.passage.parsedText;
- }
- }
- }
Add Comment
Please, Sign In to add comment