Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Namespace error, compiling script and non coder-

Discussion in 'Editor & General Support' started by junctionboss, Oct 2, 2014.

  1. junctionboss

    junctionboss

    Joined:
    May 11, 2014
    Posts:
    227
    I was trying to backup and make new script to get this camrea from clipping,,so easy right ;)..then I get this: Assets/Sample Assets/Cameras/Scripts/ProtectCameraFromWallClip.cs(5,14): error CS0101: The namespace `global::' already contains a definition for `ProtectCameraFromWallClip' < anyone know whats causing it...im a NON coder atm so I could really use some guidance
     
  2. xerotechnologiesnetllc

    xerotechnologiesnetllc

    Joined:
    Jul 1, 2014
    Posts:
    49
    Yes, absolutely. So if you copy a script, Ctrl + D to duplicate, then rename the file, you also must change the namespace in the script. Do a Find for ProtectCameraFromWallClip and you will probably find that the first entry needs to be changed to match the file name.
     
  3. junctionboss

    junctionboss

    Joined:
    May 11, 2014
    Posts:
    227
    ok TY so much,,I'lll check..I wondered if that was it, but I was having a hard time finding out how to rename scripts lOL


    here goes

    ty so much
    jb
     
  4. xerotechnologiesnetllc

    xerotechnologiesnetllc

    Joined:
    Jul 1, 2014
    Posts:
    49
    Hey no worries. Happy to help whenever my little experience can help.

    I had that mistake for a long long time.
     
  5. junctionboss

    junctionboss

    Joined:
    May 11, 2014
    Posts:
    227
    Ok I'm having some major issues here...im JUST new enough to unity that I guess this will occur :

    Is there any way you can come to #neighbors on frenode irc and help me sort this out ?

    If not I understand not everyone uses irc, it would just go much more quickly if we could do that

    I checked for name of script and it is exactly as namespace shows.

    BUT, I imported new stuff from asset store from unity devs, and now im getting a lot of errors, including namespace e rrors for 3rd person conrtroller and camera, yet I never made any changes to those things.

    DO I have a faulty unity install going on here / ;)

    thx
    jb
     
    Last edited: Oct 2, 2014
  6. xerotechnologiesnetllc

    xerotechnologiesnetllc

    Joined:
    Jul 1, 2014
    Posts:
    49
    LOL nice try but a faulty unity install is not to blame ;) I do not use IRC in any format, I'm afraid.

    So this is from one of my scripts:

    "

    using UnityEngine;
    using System.Collections;

    public class MASTER_CONTROLLER : MonoBehaviour
    "

    "pblic class MASTER_CONTROLLER: MonoBehaviour" is the namespace, i believe.
    make sure this matches the script file name.

    in this case, the filename is MASTER_CONTROLLER.cs
     
  7. junctionboss

    junctionboss

    Joined:
    May 11, 2014
    Posts:
    227


    OK I fixed it. I found out in irc, that the namespace errors were coming from having more than one script in my project with same name.

    I had NO idea unity worked that way..OUCH.

    Alll errors are fixed,,and I don't expect you to know answer to this,,but Im stil having clipping errors.

    Wrong topic, but do you by chance have any idea about how to stop terrain below my character, from showing, when I rotate character a certain angle ?

    Thanks so much for trying, you helped nudge me in the right direction ;)


    cu!
    jb
     
  8. xerotechnologiesnetllc

    xerotechnologiesnetllc

    Joined:
    Jul 1, 2014
    Posts:
    49
    There was a tutorial on youtube about that...give me a bit to find the link...
     
  9. xerotechnologiesnetllc

    xerotechnologiesnetllc

    Joined:
    Jul 1, 2014
    Posts:
    49
    Can't locate it at the moment but i think it used a raycast from the camera and whenever it struck something it disabled the renderer for that object and then on collision exit it would turn the renderer for the object back on...