How to reproduce: Simply create an AnimationClip using “AnimationClip.createWithSpriteFrames” from script. When that animation is played, nothing is shown on UI/screen.
Sample Code:
import { _decorator, Component, Node, SpriteFrame, Sprite, Animation, AnimationClip, CCInteger } from 'cc';
const { ccclass, property } = _decorator;
@ccclass('AnimationTest')
export class AnimationTest extends Component {
@property(Node)
public target: Node;
@property([SpriteFrame])
public frames: [SpriteFrame];
@property(CCInteger)
public animSpeed: number;
onLoad(){
this.createAnimation();
}
createAnimation(){
let item = this.target;
let animation = item.addComponent(Animation);
let clip = AnimationClip.createWithSpriteFrames(this.frames, this.animSpeed);
clip.name = 'item';
animation.on(Animation.EventType.FINISHED, () => {
// This message being shown in console. So, the animation is somehow playing.
console.log("Animation Finished");
});
let state = animation.createState(clip, 'item')!;
state.play();
}
}
As always, thanks for your kind help.
That was working fine in 3.2.0.
If I may suggest, Cocos Team should do more unit-tests.
You fixed some things, but broke some things else which were perfectly working fine in previous versions. Just my two cents.
Could you please try with the project I provided above?
I didn’t change the engine, but I modified the engine code and made sure that new file is used. From Sources tab, I could see the new change (I could intercept with a breakpoint as well. So, the change was applied).
Here is the video file of my test,
Before modification:20210914_173357.zip (49.1 KB)
Modified:20210914_174216.zip (93.1 KB)
Modify the engine source code, it needs to be recompiled to take effect.
If there is in effect, this file is modified inside.
File path:3.3.0\resources\resources\3d\engine\bin.cache\dev\preview\bundled\index.js
before modification:
I don’t know how to recompile form Current CC installer folder. (if you teach me, I’m willing to learn).
So, I just modified the bundled\index.js directly.
And it worked.