Stop checking object names.

Tags tell you what something is, and they don't break.

Stop checking object names.

The problem

Names break.

if ( other.Name == "Player" )    TakeDamage(); // someone renames it "Player (1)"

Duplicate the object, rename it for clarity, and every check silently stops matching.

The fix

Label what it is.

A tag is a label on a GameObject. Any object can have several, and names can change freely.

GameObject+"player"+"enemy"

The fix in code

Add it, then check it.

// when the player spawnsGameObject.Tags.Add( "player" ); // anywhere elseif ( other.Tags.Has( "player" ) )    TakeDamage();

Tags.Add labels an object. Tags.Has checks for the label, whatever the object is called.

Bonus

Traces understand tags.

var tr = Scene.Trace.Ray( start, end )    .WithoutTags( "player", "trigger" )    .Run();

Skip whole categories of objects in a trace with one call.

The rule

Ask what it is, not what it's called.

Label it
Tags.Add( "player" )
Check it
Tags.Has( "player" )
Skip in traces
WithoutTags( ... )