Unity's animation systyem is pretty good. It lets you animate pretty much every property in every component, right from in the editor. But one thing has constantly put me off using it. The fact that you end up with a ton of AnimationClip's in your project folder. I want it all to be in a prefab, I don't want the prefab and then a bunch of AnimationClips.
So I made Object Animation. The idea being that instead of creating an clip and storing it on the hard drive, it stores it in the scene or in the prefab. It isn't doing anything magic, Unity is capable of this.
You can't reference the clip anywhere, but since you're supposed to use be using it on the gameobject in which you're defining it, you can drag from the component onto anything that accepts AnimationClips. This changes if you save it as a prefab, in which case the clip is available inside the prefab ..
.. and can be found like any other asset.
The component automatically creates an Animator because you can't edit the AnimationClip without defining one. I did have a look through the editor code on github, but couldn't find a way in. It's disabled and hidden by default. If you want to show it just right click on the component and select this to make it visible.
I've previously talked about my MovePattern component.
I think I mentioned previously how I came to the realization that I was reinventing the animation system. I was thinking about adding an event system, for firing effects and sounds. The more I thought about that the more I thought about how the Animation system already has it, and I was reinventing a worse version of it.
So I made NetAnimation.
It works the same as MovePattern. The animation frame is synced to the network time, so clients see exactly the same thing - meaning it can be used for moving platforms etc. Except it takes an AnimationClip.
And we don't lose the editor preview. It's probably more useful from a level designer point of view if anything.
NetAnimationControlled is the same as NetAnimation, but instead of the animation looping constantly, it's controlled in some way by the InputOutput system. This makes it perfect for things like doors and elevators.
The new version has the benefit of being able to use different AnimationClips. In this example it uses a different clip for turning on and turning off.
Since the original intention of all this was to let level designers fire off sounds and particle effects with Animation Events, I decided to look a bit more into it.
Unity's animation events are awesome and fiddly. The pretty standard thing is to add a component to your whatever, with functions on called "Jump" and "Land" and whatever else, then trigger those in the animation. And that's cool, but I don't think we should have to edit code up to do shit like trigger sounds.
So the event map is my attempt at that.
On the left is a list of event names, and when you select one you can edit the effects on the right. The idea is that an animation (or the network, or manually) will call RunEvent( "jump" ) and then it'll do shit.
This does what I need it to do right now, but I'm hoping to expand on it and make it even more useful in the future.
I refactored a bunch of player code, and ended up ripping the old throw line code away, so I added a new system for drawing indicator lines.
This is obviously used in the throw lines..
And I added indicators to the socket system, to give a few hints on where you can plug stuff.
I did bug gulps of refactoring this week. This was mainly because I was doing other stuff on Tuesday and Thursday, and I find it hard to really get into stuff when I don't have a good long runway.
The refactoring was pretty good though. I've got most of the player class tamed and in a position to try a couple of gameplay things I've been wanting to try.
I've also got the game separated into modules. Which is meant to speed up complilation, but my hunch is that what you gain on compilation times you lose on Visual Studio freezes. It does feel nice to have everything kind of seperate and modular though, instead of the usual Unity web of files all referencing each other.
If you want to follow this project you can sign up to the mailing list.
We'll only update you about this project, we won't spam you about other stuff or sell your email address.