Hi, around the 7:25 mark, it shows that you need a reference to “self” to pass into the target of the Static Mesh Component. This makes sense, but my question is, on the Static Mesh Component Node, there’s already a small “self” box next to the input pin. What is this supposed to represent? I was under the impression that “self” is inherently pass in.
You are correct, a reference to ‘self’ (the current BP) is normally the default argument if no target node is connected. For example, this compiles just fine:
In the lecture, Sam actually copies several nodes and pastes them into the function graph. It looks like that particular Get StaticMeshComponent
node expects a target connection, despite giving the appearance that it will use ‘self’ as the default Target. If you look back a bit to where the node was copied from, you can see that Target
was originally connected to the return value of the SpawnActor BP Projectile
node.
Hooking the Target reference back up to the Self node as Sam did is fine but not necessary. You can just use the normal ‘getter’ node for the SMC like so:
Same result, but a bit cleaner.
Be wary of copy-pasta in BPs or code for that matter. It’s a well-known anti-pattern that should be avoided if you can help it.
Ahh I see, that makes sense. Thanks a bunch!
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.