At 5:06 you drop the cube, causing the bottom one to turn red. I copied your video EXACTLY, but my cube doesn't turn red. …

Forum Archive At 5:06 you drop the cube, causing the bottom one to turn red. I copied your video EXACTLY, but my cube doesn't turn red. …

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #4764
    King Oz
    Participant

      At 5:06 you drop the cube, causing the bottom one to turn red. I copied your video EXACTLY, but my cube doesn’t turn red. It just stays white. How do I fix this? I was thinking it might be because I am using unity 5.6, and I believe you are using an older version in the video. I am running unity on windows 10 64-bit.

      #23035
      King Oz
      Participant

        Ok. I used a debug.log to see if “onCollisionEnter” is actually being called and it’s not. How to I call it in the “Update” Method to it executes once per frame?

        #23036
        Jonathan Gonzalez
        Participant

          I commend you for using debug.Log, not a lot of people tend to do that and it almost always gives you an idea of what the issue is.

          Now for OnCollisionEnter, that is a specific method so if it’s misspelled and/or not capitalized properly it will just treat it as a custom method. You can try it without the if statement as such:

          void OnCollisionEnter (Collision col)
          {
          colorChange.material.color = Color.red;
          Debug.Log(“Collision Detected”);
          }

          That should work, if it doesn’t then it may be something within your scene itself that is blocking the collision from happening. The if statement with the tag just allows you to narrow things down to a specific object with that tag.

          #23037
          King Oz
          Participant

            It turned out I misspelled OnCollisionEnter. Thank you for you help! And thanks for the commendments! Your tutorials are by far the best I ever seen.

          Viewing 4 posts - 1 through 4 (of 4 total)
          • The topic ‘At 5:06 you drop the cube, causing the bottom one to turn red. I copied your video EXACTLY, but my cube doesn't turn red. …’ is closed to new replies.