Out of curiosity

I’ve noticed that only time Rick or Sam are SUPER INSISTENT on copying and pasting something is in a situation such as when Rick copy and pasted die in the video. I also noticed at one point that Sam had misspelled Between as Betwen but since the error was consistent throughout the scripts nothing notified him of that.

So my question is, why so insistent in those situations, but not others? I spent several hours trying to solve a problem that was due to a space in the filename and over half an hour trying to figure out another problem only to find that instead of writing Hit() I had written hit(). So yeah, just wondering if that’s leading up to something or what. Thanks!

The copy and paste for Rick’s die example is because of the way messaging is handled between scripts and the Animator. If the trigger in the animator is set to die, and you send an anim.SetTrigger("Die"); the call will fail, but you won’t get notified. The biggest takeaway from that is make sure your string literals are exactly what they need to be.
A similar thing happens with the Animation Events… It broadcasts to every behavior on the Animator to run Hit(), the compiler is case sensitive, so hit() doesn’t look anything like Hit()

No, I understand that case sensitivity is a thing., I’m just wondering why that seems to be the ONLY situation they ever make a very direct point of pointing out to copy and paste but they don’t do it for other situations such as when creating a namespace, or a variable, or any other situation. They ONLY seem to do it for situations where they need to put something between quotes…Maybe they don’t even know they did that…I tend to notice weird things that others don’t…hehe

Visual studio will let you know (in most cases) when you misspelled something. Except for strings.

For example (no connection to unity or any course)

Sendevent("hello");
Void Onevent(Event event){
    If (event.name === "Hello") {
        Print("event triggered");
    }
}

The code will never print “event triggered” due to the misspelled “hello”.
Visual studio can’t know that. Because there could be an event “Hello”

2 Likes

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms