I have a trouble I can not solve.
I change the cursor icon (Cursor option in Inventory Manager) from script, while the cursor is in Selected Item the texture is single when over to another item or hotspot becomes animated.
The problem is that the texture does not enter in animation even though Inventory Manager shows the check on Animate.
But if I temporarily remove my script and I set directly the cursor as animated it works regularly, so I reactivate my script and the icon this time is animated as it should be.
If I close and I re-open unity again no animation.
It would seem like an internal update problem or cache.
In EventManager.OnMouseOverMenu I do:
KickStarter.runtimeInventory.SelectedItem.cursorIcon.ClearCache ();
KickStarter.runtimeInventory.SelectedItem.cursorIcon.ClearSprites ();
KickStarter.runtimeInventory.SelectedItem.cursorIcon.texture = KickStarter.cursorManager.GetCursorIconFromID (iconTargetOver) .texture;
KickStarter.runtimeInventory.SelectedItem.cursorIcon.isAnimated = true;
KickStarter.runtimeInventory.SelectedItem.cursorIcon.numFrames = 2;
KickStarter.runtimeInventory.SelectedItem.cursorIcon.numRows = 1;
KickStarter.runtimeInventory.SelectedItem.cursorIcon.numCols = 2;
KickStarter.runtimeInventory.SelectedItem.cursorIcon.animSpeed = 2;
Comments
But rather than changing the isAnimated bool at runtime, try just setting up the "still" cursor as a 1-frame animation, so that all you need to do is change the frame settings.
Whether you have one-frame or two, that's basically what I was getting at - so that you can leave the animated field selected always.
If so, you'd want to look in the GetAnimatedRect (first instance) function inside CursorIcon, though I'll look into it as well.