Posts

Showing posts from September, 2017

Performance tips for Unity 2d mobile

There's no one silver bullet to optimisation, and what works for one person mightn't work for another, so these tips are mainly focused on 2D. Your mileage may vary. It goes without saying that the performance issues were found using the profiler, so if you have it, it's something you should be using. The dumb stuff Let's get the dumb stuff out of the way first. These are the simple things you need to do, and don't need much discussion. Set your Application.targetFrameRate to 60. By default on mobile, it's 30 Otherwise you can turn on vSyncCount in the quality settings. Apparently, on some Android devices, with Android 5, you can render at more than 60fps, so if you don't force vSync, you run the risk of an unresponsive device, as it's rendering too quickly, so it's possible that future versions of Unity will force this When testing, test on an actual device - you can run on the desktop to make sure it doesn't crash, but it won't ...

Remapping the Animation Hierarchy in Unity

Image
Working with animations in Unity has some quirks. Sometimes I will make an animation and I animated the wrong object. I might have realized I want to animate the container for an object, or accidentally animated the parent when I wanted to animate the child (this happens more often than I’d like to admit!). Cube2 has been renamed to MegaCube, breaking the animation. Unity does not come out of the box with functionality to remap animations between objects.  But there are a few options to make your life easier. I’ll go over 3 ways to fix this: the Animation Hierarchy Editor, my Search & Replace tool, and manually editing the YAML. Animation Paths – What are they? All three methods share the same thing: I want to re-map the ‘path’ of the animation clip’s property to the correct path. What do paths look like? They are simply strings that map the path from the animation root to the animated object. Game objects names are separated by a slash (/) charac...