Skip to content

Instantly share code, notes, and snippets.

@tarocco
tarocco / AnimatorEvaluate.cs
Last active March 11, 2022 05:03
Component to evaluate Unity Animator in-editor with the press of a button by calling Animator.Update(0f) exactly once. Useful for applying one frame of animation to an object, such as a model pose, and saving it permanently in the scene. Supports undo.
using System;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
[RequireComponent(typeof(Animator))]
public class AnimatorEvaluate : MonoBehaviour
{
}
@tarocco
tarocco / Unity Encapsulation Tutorial.md
Last active March 11, 2022 05:05
Best practices for making your serialized classes code & editor-friendly!

Unity Encapsulation Tutorial

by Tarocco

Fields and Properties

Unity does not serialize properties or any static members. You have some options for serializing member fields.

Field-only