DragonBones / DragonBonesCSharp

DragonBones C# Runtime
MIT License
537 stars 198 forks source link

Get a null if instantiate data from Unity editor #45

Closed Airat1995 closed 6 years ago

Airat1995 commented 6 years ago

Hi! Can I play an animation from code if I created it from the editor and saved as prefab? Why if I use code like that I got and NullRefrenceException? dgb.GetComponent<UnityArmatureComponent>().animation.Play("Calm"); Or I must define data from code to make unit animated?

wuliao2230 commented 6 years ago

Yes, you can play an animation from code. I guess the error was caused by the previous reference(dgb or UnityArmatureComponent or animation). You can find out which reference is empty at the breakpoint.

Airat1995 commented 6 years ago

Ok, thanks. Mb lost animation somewhere.