使用Animator.StringtoHash(“")有什么好处? [英] What is the benefit of using Animator.StringtoHash("")?

查看:351
本文介绍了使用Animator.StringtoHash(“")有什么好处?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么可以在将动画器组件与字符串一起使用的同时使用Animator.StringToHash(")?

Why should you use Animator.StringToHash("") while you can use animator component with strings?

推荐答案

Animator.StringToHash用于优化目的.比较两个ints比比较两个strings更快.

Animator.StringToHash is used for optimization purposes. Comparing two ints is faster than comparing two strings.

通常在比较许多动画状态时使用. Animator.StringToHash会将动画师(string)的名称转换为id(int).您可以让他们用整数而不是字符串来比较动画状态.

This is mostly used when comparing many animation state. Animator.StringToHash will convert the name of the animator(string) to an id(int). You can them compare animation state with integers instead of strings.

您可以在此处了解更多信息.

You can learn more about this here.

这篇关于使用Animator.StringtoHash(“")有什么好处?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆