- Home /
Question by
LegionIsTaken · Oct 30, 2011 at 02:04 PM ·
read-only
animation[AnimationClip.name].length is read only, any workarounds?
Hi,
I am creating a script that can be used over and over again without any scripting required and therefore I really need the animations stored in variables instead of accessing them through script. This is not a problem, but for my script I need to access the stored animations length.
What I have, in short is this this:
var ANI : AnimationClip;
function Update (){
if(something){
animation[ANI.name].speed = 1.0;
animation[ANI.name].length = 0;
}
else if(something else){
animation[ANI.name].speed = -1.0;
animation[ANI.name].length=blahblah;
}
}
But length is unfortunately read only(what ever than means), so I can't use it. Is there any workaround on this?
Thank you
Comment
Why are you trying to change the length of the animation? It's read only (which actually means exactly what it says) for a reason. What exactly are you trying to do? It is quite possible to access the values without trying to assign to them like you are doing there.
Your answer
![](https://koobas.hobune.stream/wayback/20220613024908im_/https://answers.unity.com/themes/thub/images/avi.jpg)