- Home /
How to Convert This Line to Fit the New API?
This is a very simple question and I feel a bit silly asking it (especially since I've been using JS in Unity for quite a long time), but I've tried everything I can think of and I can't figure it out. I've also looked everywhere but can't seem to find anything on this particular function.
What would be the new way to write this line, to go with the new API? I have a ton of lines like this all throughout my project, but of course, they don't work anymore.
animation["walk"].speed = 1.46;
I'm using "GetComponent()" to play and crossfade animations, but as far as referencing and modifying the properties of a certain animation like this, what would be the new way to write it?
I've tried this, among other things, but nothing has worked:
GetComponent(Animation["walk"]).speed = 1.46;
I don't know if I'm close or not, but these API changes are making me feel like a newbie all over again.
Also, I'm not sure if these lines are something the API updater should fix, but my updater is apparently broken and I've been having to fix everything manually.
Could someone be so kind as to show me the newly required method? I've only ever used the old one so this is new to me.
Answer by Eric5h5 · Mar 08, 2015 at 04:26 AM
Replace animation
with GetComponent(Animation)
. Leave everything else as it was (the square brackets don't go inside GetComponent).
Dang, I should've just kept trying because I actually came pretty close to this.
Now I really feel silly. I wish I had just thought about it logically.
Thanks!
Your answer
Follow this Question
Related Questions
How do I fix my game after API failing to update my scripts 2 Answers
For some reason when I updated my project to work with Unity 5 the script updater failed 0 Answers
Export Animations From Unity3D into Blender? 1 Answer
Unity 2D Update Release (Tile Map)? 0 Answers
Noob question. Game is pausing using Update but not on FixedUpdate? 0 Answers