- Home /
Question by
Gimows · Sep 21, 2016 at 01:17 PM ·
animationscripting problemanimatorscripting beginner
Can I change animation key frame property in script?
For example I have a code for an object and a camera:
public GameObject object1;
public Camera camera1;
void Start()
{
object1.transform.position = new Vector3(Random.Range(-3f, 3f), Random.Range(-3f, 3f), 0);
camera1.transform.position = new Vector3(0, 0, -10);
}
And I want for second key frame in animation to set x and y position from object1.
How can I edit this in script?
unity-2016-09-20-00-09-19.png
(21.8 kB)
Comment
Did you ever find an answer to this? I have the same exact question.
Answer by hexagonius · Oct 30, 2018 at 08:24 PM
Would that also apply to $$anonymous$$eyframes that are created in the new Timeline Animation tracks? It seems to mention legacy animations only.
I just confirmed, it only works with legacy animation, and not with the new Timeline for 2017 version.
you said nothing about timeline, just that you had the exact same problem, which sounds different to me.
ask a new question referring to timeline.