Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(1 edit)

Hi Chris,

I dropped a comment on Part 5 Animations from Code about receiving an error message. So I started the script from scratch, just in case may I had followed it wrong but I still received the same message. So I decided to purchase your asset pack so I could triple check if it was my issue but I received the exact same error message. 

I removed the ArgumentException and replaced it with Debug.Log because Unity didn't like ArgumentException.

The error I received is; 

error CS0161: 'DirectionalAnimationSet.GetFacingClip(Vector2)': not all code paths return a value

I'm not sure if it is because I'm using Unity 2020.3? But maybe you'll be able to explain what I've done wrong?

When you use Debug.Log you have to return an animationClip or return null. The argument exception breaks the code's execution but debug.log only leaves a message in the console.

If you add return null after the debug line then you should be good.

When a function has an AnimationClip return type, it must always either return an animation clip, return null.

(+1)

Thank you again Chris. Sorry you replied to me twice. I have since added return null and I'm no longer stuck in safe mode.