<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/i-completely-stopped-using-this-method-here-s-why--y47jecles" -->

---
title: I completely STOPPED using this method, here&#x27;s why.
description: Using Transform.Find() with string identifiers in Unity is error-prone because invisible characters or typos cause null reference exceptions that are nearly...
canonical: https://daily.dev/posts/i-completely-stopped-using-this-method-here-s-why--y47jecles
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: I completely STOPPED using this method, here&#x27;s why. | daily.dev
og:description: Using Transform.Find() with string identifiers in Unity is error-prone because invisible characters or typos cause null reference exceptions that are nearly...
og:url: https://daily.dev/posts/i-completely-stopped-using-this-method-here-s-why--y47jecles
og:image: https://api.daily.dev/og/posts/y47JeclEs.png
og:image:alt: I completely STOPPED using this method, here&#x27;s why.
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# I completely STOPPED using this method, here's why.

**[Code Monkey](https://daily.dev/sources/codemonkeyunity)** · 1 min read · 3 upvotes · 0 comments

## Summary

Using Transform.Find() with string identifiers in Unity is error-prone because invisible characters or typos cause null reference exceptions that are nearly impossible to debug. The recommended alternative is to declare private serialized fields, which exposes them in the Unity Inspector for drag-and-drop assignment, eliminating string-based lookups entirely.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.youtube.com/watch?v=-sj1dnCuJYs>

## Questions this post answers

### why does my Unity transform.Find call throw a NullReferenceException even though the name looks correct

A hidden whitespace character in the GameObject name is a common cause, since transform.Find matches exact strings and a trailing space makes the name different from what appears in code. Because strings are error-prone identifiers, using SerializeField fields with drag-and-drop references in the Inspector avoids this class of bug entirely by removing string matching from the lookup.

_Developers debugging tricky Unity reference errors can find more object-reference patterns on daily.dev._

---

Tags: [#game-development](https://daily.dev/tags/game-development), [#c#](https://daily.dev/tags/c#), [#unity](https://daily.dev/tags/unity)

[View this post on daily.dev](https://daily.dev/posts/i-completely-stopped-using-this-method-here-s-why--y47jecles)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"I completely STOPPED using this method, here's why.","url":"https://daily.dev/posts/i-completely-stopped-using-this-method-here-s-why--y47jecles","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/i-completely-stopped-using-this-method-here-s-why--y47jecles"},"datePublished":"2026-07-14T14:24:33.938Z","dateModified":"2026-09-14T08:40:09.031Z","description":"Using Transform.Find() with string identifiers in Unity is error-prone because invisible characters or typos cause null reference exceptions that are nearly...","image":"https://i.ytimg.com/vi/-sj1dnCuJYs/sddefault.jpg","thumbnailUrl":"https://i.ytimg.com/vi/-sj1dnCuJYs/sddefault.jpg","isAccessibleForFree":true,"articleSection":"Code Monkey","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Code Monkey","logo":"https://media.daily.dev/image/upload/s--mgoqDIgw--/f_auto/v1727446687/logos/codemonkeyunity","url":"https://daily.dev/sources/codemonkeyunity"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/i-completely-stopped-using-this-method-here-s-why--y47jecles","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":3},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"game-development,c#,unity","timeRequired":"PT1M","video":{"@type":"VideoObject","name":"I completely STOPPED using this method, here's why.","description":"Using Transform.Find() with string identifiers in Unity is error-prone because invisible characters or typos cause null reference exceptions that are nearly...","thumbnailUrl":"https://i.ytimg.com/vi/-sj1dnCuJYs/sddefault.jpg","uploadDate":"2026-07-14T14:24:33.938Z","duration":"PT1M","url":"https://api.daily.dev/r/y47JeclEs","embedUrl":"https://www.youtube.com/embed/-sj1dnCuJYs"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Code Monkey","item":"https://daily.dev/sources/codemonkeyunity"},{"@type":"ListItem","position":3,"name":"I completely STOPPED using this method, here's why."}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/i-completely-stopped-using-this-method-here-s-why--y47jecles#faq","mainEntity":[{"@type":"Question","name":"why does my Unity transform.Find call throw a NullReferenceException even though the name looks correct","acceptedAnswer":{"@type":"Answer","text":"A hidden whitespace character in the GameObject name is a common cause, since transform.Find matches exact strings and a trailing space makes the name different from what appears in code. Because strings are error-prone identifiers, using SerializeField fields with drag-and-drop references in the Inspector avoids this class of bug entirely by removing string matching from the lookup. Developers debugging tricky Unity reference errors can find more object-reference patterns on daily.dev."}}]}
```

