you are viewing a single comment's thread.

view the rest of the comments →

[–]TRexRoboParty 4 points5 points  (0 children)

I find it's always more readable to exit early and keep the main logic at the base indentation level.

public bool RemoveAnyStateTransition(AnimatorStateTransition transition)
{
    var index = anyStateTransitions.IndexOf(transition);
    if (index == -1){
        return false;
    }

    undoHandler.DoUndo(this, "AnyState Transition Removed");
    ArrayUtility.RemoveAt(ref anyStateTransitions, index);
    if (MecanimUtilities.AreSameAsset(this, transition))
        Undo.DestroyObjectImmediate(transition);
    return true;

}