Nerd For Tech
Published in

Nerd For Tech

Optimizing the Animator and Callouts

Let’s take a look at how we can go about creating methods in which to utilize our animation transitions. When we go about coding some animations, we can take a longer process and code each individual transition that happens like so:

However, do it this way becomes rather tedious and if you have more than a couple different animations, it will take a long time to go about creating all of the required transitions. Instead, let’s look at how we can go about and index the transitions so that we can simplify the process:

By doing it this way, what we are able to do is determine by Int value, the different values each stage will be at. This allows us a much easier way of coding in the transitions into the program:

Now that we have our horse animation transitioning as intended, let’s take a look at how we can go about creating the callout that shows up when we go to the muscle:

First, we need to create a target and the start position. On our start position, which will be a label, we are going to add in the line renderer component. This will allow us to draw a line from the start position to the target position. Next, we will want to make sure that it is a thin line, so we shrink down the width on either end to 0.1. Now, in order to create the method in which we have our line appear and disappear at the proper moment, we will need to code it within our UIManager:

With this logic, we are telling Unity that we want it so that when the value of our currentAnim is set to 1, we will enable our label which will then activate the line between the points. However, if the value of it is not 1, we want the label to be disabled so that it doesn’t stay up there forever. With all of this set up, and everything attached to where it should be within Unity, let’s take a look at what it looks like within the program:

As we can see, the label shows up when we go into our muscle image and when we go to a different state, we have our label disappear again.
There we have it, we’ve looked at how we can index our animation transitions along with creating a callout and having it appear during a specific animation.

--

--

--

NFT is an Educational Media House. Our mission is to bring the invaluable knowledge and experiences of experts from all over the world to the novice. To know more about us, visit https://www.nerdfortech.org/.

Recommended from Medium

What is InsureDAO, join and test now.

Serverless with OpenFaas, Kubernetes, and Python

Hi, I’m John and I’m aspiring to become a full stack developer.

Never Ending Story of Delivery

What do they mean by “One Database Per Microservice”?

Using Widgets to Make Plotting Using Matplotlib Easy (Using Football Data)

Why You Should Use Reverse Proxies on Alibaba Cloud

Working with S3 Buckets in Python

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Jordan Evans

Jordan Evans

More from Medium

Understanding Big O

Day 17 of my Developer Journey: Creating the Speed Boost Powerup

Catching up: Game Development

Game Dev Digest Issue #126 — Moving Things, And Looking Good

Issue #126 - Moving Things, And Looking Good