You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using UnityEngine;classC:MonoBehaviour{publicTransformother;privatefloatfarDistance=5.0f;voidUpdate(){if((other.position - transform.position).magnitude >farDistance){//OPTIMIZE THIS CALL BY USING sqrMagnitude}}}
Code with Fix
using UnityEngine;classC:MonoBehaviour{publicTransformother;privatefloatfarDistance=5.0f;voidUpdate(){if((other.position - transform.position).sqrMagnitude >farDistance*farDistance){}}}