Search Unity

A silly bug of a noob :( I need help. error CS0117: 'Debug' does not contain a definition for 'log'

Discussion in 'Getting Started' started by ferminmedina2002, Oct 23, 2019.

  1. ferminmedina2002

    ferminmedina2002

    Joined:
    Oct 23, 2019
    Posts:
    4
    Hi, I'm following a tutorial (a bit old) and I have a problem in the following script:
    Code (CSharp):
    1.  
    2. using UnityEngine;
    3.  
    4.  
    5. public class Player_Colosion : MonoBehaviour
    6.     {
    7.         void OnColissionEnter()
    8.     {
    9.  
    10.         Debug.log ("We hit something");
    11.  
    12.     }
    13.     }
    14.  

    The version of my unity is 2018.4.11f1 (64-bit) and im following this tutorial:
    ...

    I don't know if it's my mistake or if debug.log is no longer used like that.
     
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    Carefully check your capitalization and spelling. Debug.Log has the wrong capitalization, and OnCollisionEnter is misspelled (which would not generate an error, but it wouldn't work either).
     
    sm265491, ferminmedina2002 and Ryiah like this.
  3. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,190
    You beat me to the first one (was typing up the response as you posted), but I totally missed the method being off. :p
     
    ferminmedina2002 and JoeStrout like this.
  4. ferminmedina2002

    ferminmedina2002

    Joined:
    Oct 23, 2019
    Posts:
    4
    Thankss, you are awesome <3
     
  5. zekecrall

    zekecrall

    Joined:
    Apr 23, 2020
    Posts:
    2
    omfg i spent 20 mins debugging for a capitalization error iwtfd
     
  6. ryomastrofini1

    ryomastrofini1

    Joined:
    Apr 18, 2020
    Posts:
    2
    I have the same problem too, with these two scripts:
    Code (CSharp):
    1. using UnityEditor;
    2. using UnityEngine;
    3.  
    4. public static class HandleUtilityProxy
    5. {
    6.     public static GameObject FindSelectionBase(GameObject gameObject)
    7.     {
    8.         return HandleUtility.FindSelectionBase(gameObject);
    9.     }
    10. }
    and:

    Code (CSharp):
    1. using UnityEditor;
    2. using UnityEngine;
    3.  
    4. public static class AudioUtilProxy
    5. {
    6.     public static void PlayClip(AudioClip audioClip)
    7.     {
    8.         AudioUtil.PlayClip(audioClip);
     
  7. RichAllen2023

    RichAllen2023

    Joined:
    Jul 19, 2016
    Posts:
    1,026
    I hate to be pedantic but you spelt collision wrong for one.

    Check and double check your spelling when writing code, the slightest typo and it won't thank you, as I discovered doing a "Hello World" C# tutorial last week from a book.
     
  8. Wolfos

    Wolfos

    Joined:
    Mar 17, 2011
    Posts:
    951
    A proper IDE (Visual Studio or Rider) will autocorrect this for you.
     
  9. Caffeine-Yeen

    Caffeine-Yeen

    Joined:
    Jan 6, 2024
    Posts:
    1
    Im having a similar issue this is my script and i do not know how to fix it.Assets\PumkinsAvatarTools\Scripts\Editor\Destroyers\LegacyDestroyer.cs(98,28): error CS0117: 'Helpers' does not contain a definition for 'DestroyMissingScriptsInGameObject' and this is the script where it tells me it is.
    Code (CSharp):
    1.  var ts = avatar.GetComponentsInChildren<Transform>(true);
    2.             foreach(var t in ts)
    3.             {
    4.                 if(Helpers.DestroyMissingScriptsInGameObject(t.gameObject))
    5.                     PumkinsAvatarTools.Log(Strings.Log.hasMissingScriptDestroying, LogType.Log, Helpers.GetTransformPath(t, avatar.transform));
    6.             }