Calling get component

was wondering if there was a specific reason why you kept calling get component say attacker/ animator in the if statements (that are continuously checked, rather than caching the reference in start, eg.

private Animator animator;
animator = GetComponent();

Hi Necro,

You are right. For reason of performance, it makes sense to cache the reference instead of looking for it whenever the Fox collides with something.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms