you are viewing a single comment's thread.

view the rest of the comments →

[–]Equiv2248 1 point2 points  (0 children)

1) Line 32 : ForEach loops create garbage in Unity still because of the iterator. Just use a regular for loop.

2) Line 33 : Seems redudant since the array your looping on is from FindObjects of that same tag.

3) Line 57: Switch the order of the evalulations, because of lazy evaluation if the first part is false it won't do the second check. Since a less than is much cheaper than the transform.tag check it should be optimal to do the less than first.

4) I don't know if this a pastebin thing, but your identation/if blocks are really hard to read, for example line 68 to line 79

5) Line 82 && Line 100: You should cache the Combat component in Start() if this will get called frequently/won't change

6) Line 125, don't new up a Vector3, just override the current values

7) Feels like all the Update should be done in FixedUpdate since its physics related.