Upcoming changes to UnitySteer
I’ve continued updating UnitySteer as we work on our game (eating our own dogfood, as they say), and I wanted to poll the community a bit in case anyone has objections to some upcoming changes.
1) Remove CharacterMotorVehicle and CharacterMotorVehicleEditor.
These classes depend on Unity’s CharacterMotor, which is included on the Standard Assets as a Unity script class. We’ve translated it to C# and are iterating over it to do some changes here and there, but part of this is that the naming conventions no longer match those used by Unity on the original. I’d rather remove it from the main repository than have in it something that will introduce noise for the majority of users (who may not even care about that particular behaviour).
2) Change the radar collections to C5.
The C5 collections are still better designed than the .Net ones, even on 3.5. For instance, List(T) has a Find method, but IList(T) doesn’t. List(T).AsReadOnly returns an IList, which means you can’t do .Find on it. So if you’d like to have that, you have to forget about the safety net of AsReadOnly, and end up writing to the implementation.
C5 allows us to return a GuardedList that behaves consistent with what you would expect from List, and on top of that the collection gets us other features.
I already have these changes implemented in a local branch, but haven’t merged them to development yet.










Hey Ricardo,
For what it’s worth, I’ve actually just ported my copy of UnitySteer back from C5 to System.Collections.Generic. As much as the API design of C5 may be nicer, it seems to be much worse in terms of allocations (and thus runtime speed). For example, ArrayList doesn’t have a distinct concept of capacity; ArrayList.Clear() doesn’t just remove all items, but actually reallocates the internal array at the smallest size again. By switching back to the BCL and simplifying the code a bit (at the cost of some enforced correctness – no more GuardedList, for example) I’ve reduced steering allocations from 5KB/frame down to just 90 bytes.
Hi Richard,
Thanks for the comments about C5, it’s good to know that it behaves that way. I removed all C5 dependencies about a year ago on the experimental branch while working on what ended up becoming 2.5, but those changes didn’t make it into master until recently.
Cheers!