Quantcast
Channel: Questions in topic: "dynamically"
Viewing all articles
Browse latest Browse all 152

Best way of using animator bools in a script

$
0
0
Hey, sorry if the title is strange, i kinda don't know exactly what to type in as a title. Anyway, i am intrigued. I am working on a mobile game, and i am doing my best to keep everything as smooth and mobile friendly as possible, but i am facing a problem with a script of mine. I have two "tilt" animation for my character for when the player is rotating the device, and i want to trigger them accordingly. For now i am testing only on the PC, and i really want answers for PC too bcs i know how to translate them to mobile later. Here is an example of what i am using: void Update() { If (Input.GetKey("a") { anim.SetBool("TiltLeft",true); } If (!Input.GetKey("a") { anim.SetBool("TiltLeft",false); } } But to be sincere, this method is horrible for performance, as it is placed on Update. I was thinking about adding a `void LateUpdate` and place the code there, but this would mean to have two... "fast" voids at the same time. I thought about using a bool, but this would also be insignificant. My question is: **What would be the best method to implement this "dynamic" bool system into my script?**

Viewing all articles
Browse latest Browse all 152

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>