-
Notifications
You must be signed in to change notification settings - Fork 367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
在FormattableTextMeshProUGUI & TemplateTextMeshProUGUI中Text.text会被自身的OnEnable设置为初始值 #38
Comments
好的,我改一下 |
GenericParameters<int, int,string> example;
ViewModel = new FormattableViewModel();
BindingSet<FormattableView, FormattableViewModel> bindingSet = this.CreateBindingSet(ViewModel);
bindingSet.Bind(Example).For(v => v.Parameter1).To(vm => vm.Month);
bindingSet.Bind(Example).For(v => v.Parameter2).To(vm => vm.Day);
bindingSet.Bind(Example).For(v => v.Parameter3).To(vm => vm.Hour);
protected internal override void OnParameterChanged()
{
try
{
if (m_Text == null || !m_Text.enabled)
return;
m_Text.SetText(BUFFER.Clear().AppendFormat<P1, P2, P3>(m_Text.Format, parameter1, parameter2, Parameter3));
}
catch (Exception e)
{
#if DEBUG
if (Application.isEditor)
Debug.LogWarning(e);
#endif
m_Text.SetText(BUFFER.Clear().Append(m_Text.Format));
}
} 另外在上述示例中,当 |
真是一个奇怪的bug,下面的代码,第一次点击Unity的Play运行时,正确调用 Format(ReadOnlySpan format,object value, StringBuilder builder)这个函数,但是第二次点击Play,则调用的是 void Format(string format, object value, StringBuilder builder)函数,所以崩溃了。 IFormatter formatter = IFormatter.GetFormatter(); |
源代码:
重现步骤:
Text.text
会被Initialize
设置为Text.Format
The text was updated successfully, but these errors were encountered: