Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

<b>2 Unity packages' script names interfering. Not the regular issue!</b>

Discussion in 'Scripting' started by varunvp, Sep 30, 2016.

  1. varunvp

    varunvp

    Joined:
    Jul 11, 2014
    Posts:
    57
    Hey guys,
    This is not the normal 'There is already another script with this name in this namespace' error. I am surprised how no one has encountered this issue so far.

    I have Unity's CrossPlatformInput package installed in my project. Sadly this package contains a script with name 'Button', which interferes with Unity's UI Button. This does not show up as an error, but when typing a program, it always references to the cross platform input's Button script, even if I have imported UnityEngine.UI. My only solution now seems to have a namespace around the CrossPlatformInput's Button script, but DOZENS of other scripts which depend on it will stop working! I'll have to import that namespace in all those scripts. Is this the only choice?
    Thanks!
     
    Last edited: Sep 30, 2016
  2. varunvp

    varunvp

    Joined:
    Jul 11, 2014
    Posts:
    57
    Looks like the title doesn't become bold that way.....o_O
     
  3. gcoope

    gcoope

    Joined:
    Dec 20, 2012
    Posts:
    11
    Annoying, but try and use
    Code (CSharp):
    1. UnityEngine.UI.Button
    instead of just
    Code (CSharp):
    1. Button
    Edit: Alternatively you could look into Using Alias, a neat C# feature: https://www.dotnetperls.com/using-alias
     
    varunvp likes this.
  4. varunvp

    varunvp

    Joined:
    Jul 11, 2014
    Posts:
    57
    I don't know how I missed this!!! Thanks!

    The alias feature is cool too!
     
    gcoope likes this.
  5. LeftyRighty

    LeftyRighty

    Joined:
    Nov 2, 2012
    Posts:
    5,148
    because trying to get extra attention through "fancy" formatting or lots of caps/exclaimation marks/whatever isn't really needed... ? :p :)