The FindWithTag squiggly was not because of a type issue

Just a minor thing, but the squiggly from the “FindWithTag” was because “FindWithTag” is a class method of GameObject and he was writing is as an instance method. So it was a “method not found” error, separate from the Transform/GameObject issue which was also going to show up.

5 Likes

You would think that they would go back and fix the videos or at least add some text to explain that he is leading people down the wrong path. A crucial omission in my opinion.

He makes it look as if the type of the variable was the problem, but you could actually just leave it a Transform and init it as follows (GameObject.FindWithTag("SpawnedAtRuntime").transform). That would make the whole “I don’t like to use transform twice” speech. This leads to confusion, especially among people with little programming knowledge.

Luckily I spotted this (I’m a programmer) and am mainly here to learn about Unity. Unfortunately he does sometimes make similar mistakes for non-programming things as well which are not that easy to spot and which spoil the otherwise enjoyable learning experience.

4 Likes

Good point, I also came up with your solution and was surprised that Rick did not mention it from the start: parent = GameObject.FindWithTag("SpawnedAtRuntime").transform;

I thought that maybe it was due to performance reasons?
As if you wouldn’t want to add the transform bit every time it searches for the SpawnAtRuntime tag.
But since this is only declared in the Start() method, it doesn’t cost that much in performance (right?)

1 Like

Privacy & Terms