Author Topic: The type or namespace name 'UI2DSprite' could not be found (ARM)  (Read 5949 times)

cygnus

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 12
    • View Profile
Everything works fine when vuilding my project against a desktop target, however we want the project to be launched from within the Windows Store.
Building the project (Visual Studio 2013 project) againt the ARM target, following issue does pop up, preventing the project from building:

  1. Error   1       The type or namespace name 'UI2DSprite' could not be found (are you missing a using directive or an assembly reference?)        F:\Unity 4\Chess\Unity\Assets\NGUI\Scripts\Interaction\UIButton.cs      78      25      Assembly-CSharp-metro-vs2013

I'm using the latest NGUI 3.6.3 (yes, I completely removed the previous version of NGUI and no other asset is dependent on NGUI, so no lite versions etc are in the project) and Unity 4.5.0f6.
Looking at the project within Unity I see the file UI2DSprite is present and has the following preconditions specified:
  1. #if !UNITY_3_5 && !UNITY_4_0 && !UNITY_4_1 && !UNITY_4_2
This would mean the UI2DSprite class should be included into the visual studio project and it is, as I can locate it under Assembly-CSharp-metro-vs2013 (Windows 8.1)\Assets\NGUI\Scripts\UI.
For some reason the class isn't picked up though.

Anyone any idea on how to resolve this?


cygnus

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 12
    • View Profile
Re: The type or namespace name 'UI2DSprite' could not be found (ARM)
« Reply #1 on: June 09, 2014, 04:12:17 AM »
Solved it by removing the
  1. #if !UNITY_3_5 && !UNITY_4_0 && !UNITY_4_1 && !UNITY_4_2
predefines as I'm running Unity 4.5. Something must be wrong with this check though  :-\

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: The type or namespace name 'UI2DSprite' could not be found (ARM)
« Reply #2 on: June 09, 2014, 12:09:39 PM »
Could be that one of those are defined somewhere as a left over from the older editor? Try in Visual to do a check for it by just typing them out, then you'll see if they're defined.

It can be defined either in the build settiings or in an external file that I can't remember the name of.

ScottV42

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 6
    • View Profile
Re: The type or namespace name 'UI2DSprite' could not be found (ARM)
« Reply #3 on: June 16, 2014, 10:25:58 PM »
I am seeing the exact same thing, on x86. I replace the faulty preprocessor symbols "UNITY_4_0_0" and "UNITY_4_0" with "UNITY_4_5_0" and "UNITY_4_5". This works, until I have to make another build. After every build, the Preprocessor symbols get changed back to the same bad values. I don't see how this could be left over from an old editor. I am not sure if I every had Unity 4.0.0 on this box, if I did it was several months and many upgrades ago.

I would like to find a better solution than ripping out all the code that screws up because of the bad preprocessor symbol.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: The type or namespace name 'UI2DSprite' could not be found (ARM)
« Reply #4 on: June 17, 2014, 01:29:34 PM »
Try Assets -> Sync MonoDevelop Project

ScottV42

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 6
    • View Profile
Re: The type or namespace name 'UI2DSprite' could not be found (ARM)
« Reply #5 on: June 19, 2014, 11:28:16 AM »
This post is about building a Windows Store App, which requires Visual Studio. I am having problems with the symbols produced for the Visual Studio build. Sync the MonoDevelop project has no effect.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: The type or namespace name 'UI2DSprite' could not be found (ARM)
« Reply #6 on: June 19, 2014, 06:36:51 PM »
Then try building again. The WSA solution is created by Unity when you build. If this doesn't solve it, then I suggest reporting a bug to Unity. WSA/WP8 support is still in beta stage judging by all the bugs.