im watching this tutorial on animation
and this line of code
[SerializeField] private Animator MyAnimatorController;
wont work. i followed the tutorial exactly. did somthing change between now and when the tutorial was made?
im watching this tutorial on animation
and this line of code
[SerializeField] private Animator MyAnimatorController;
wont work. i followed the tutorial exactly. did somthing change between now and when the tutorial was made?
In what way is it not working? Is there a compile error?
Tutorial shows that line as follows (time in video = 6:53):
Maybe share your code with codetags, it must be something else in your code…
there was a compier error but i left it alone for a few days and it fixed itself?
there really wasnt enything else in my code since i had just started the script
Can I buy your compiler?
. so if im understanding the line of code
[SerializeField] private Animator myAnimatorController;
Animator is the type. and myAnimatorController is the name?
Correct! This particular line of code declares a variable. This particular kind of variable is called a “field” or “instance variable” or “member variable”. Learn more here https://www.pluralsight.com/guides/declaring-and-initializing-variables-in-c
ok thank you i was struggling
so if i have an asset or animator controller named “Crossfade” i would put
[SerializeField] private Animator Crossfade;
?
Bingo.
you know what i think i might be finaly learning c#. after like 7 months using it
Haha. You never stop learning! I’ve been programming for 12 years, and using Unity/C# for at least 7 (still a baby compared to some people on this very forum) and I’m still learning new things every day.
lol true