Code considerations

After following the respective lecture, found that the declaration
Vector2Int gridPos;
was no longer needed/referenced in the WayPoint script.

Also, wouldn’t doing the instruction in CubeEditor script
textMesh = GetComponentInChildren();
be appropriate in Awake or Start instead of being determined multiple times every frame through the procedure calls in Update? Just thinking about optimization…

You’re absolutely correct about caching textMesh in Awake() or Start(). There’s generally no reason to believe that the textMesh is likely to change throughout the course of the game, so caching it is a better option than placing it in update.

Privacy & Terms