Author Topic: Update Problems from 2.7 to 3.x. The type or namespace name `UISprite' could not  (Read 15644 times)

Tiles

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 35
    • View Profile
I try to update my project to the latest NGUI version at the moment. But i have some trouble with that.

First, the update description was not really helpful. I did open a new scene, did delete the NGUI folder, and get nevertheless thrown to death with a thousand warnings then with importing the new NGUI version. I had to delete the NGUI stuff in the Plugins folder too. And i had to install the Upgrade Tools (2.7.0 to 3.X), and move their content to the Plugins folder. Which reduces the number of error messages to three. But now i am stuck.

Where did i something wrong? What do i have to fix here to get rid of the last three warnings? I am happy about any help here :)

  1. Assets/Plugins/Runtime/UIFilledSprite.cs(13,31): error CS0246: The type or namespace name `UISprite' could not be found. Are you missing a using directive or an assembly reference?
  2.  
  3. Assets/Plugins/Runtime/UIInputSaved.cs(12,29): error CS0246: The type or namespace name `UIInput' could not be found. Are you missing a using directive or an assembly reference?
  4.  
  5. Assets/Plugins/Runtime/UISlicedSprite.cs(13,31): error CS0246: The type or namespace name `UISprite' could not be found. Are you missing a using directive or an assembly reference?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
I am going to assume that the reason you're moving NGUI into the plugins folder is because you're using javascript, since there is no reason to do so otherwise.

Those errors tell you that the scripts in the plugins folder can't find NGUI scripts, which implies that NGUI itself is currently outside of the plugins folder. Search for "UISprite" in the Project View and note where it's located.

Tiles

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 35
    • View Profile
Thanks ArenMook. Yes, i use Javascript :)

UISprite is located in NGUI\Scripts\UI\UISprite.cs

What do i need to do to fix the errors now? Move the whole NGUI folder into Plugins?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile

Tiles

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 35
    • View Profile
Thanks ArenMook.

This throws two new errors now though:

  1. Assets/Plugins/Editor/UIFilledSpriteInspector.cs(14,40): error CS0246: The type or namespace name `UISpriteInspector' could not be found. Are you missing a using directive or an assembly refer
  2.  
  3. Assets/Plugins/Editor/UISlicedSpriteInspector.cs(14,40): error CS0246: The type or namespace name `UISpriteInspector' could not be found. Are you missing a using directive or an assembly reference?
  4.  

Tiles

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 35
    • View Profile
Have it. I needed to move the content of the NGUI\Editor folder to Plugins\Editor too. That one`s not documented.

Thanks for help :)

EDIT. The move has unfortunately changed the scaling of my font. Nothing fits anymore. The letters are much too small now. Seems that i have to stay with version 2.7.
« Last Edit: December 01, 2013, 12:32:30 PM by Tiles »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
2.7 to 3.X may be a challenging upgrade, depending on your code and how the UI was used. I've made a video to help, in which I actually go through the process myself and update Starlink UI kit from 2.7 to 3.0. The process for me took about 20 minutes, but I knew what to look for -- so your results may vary.

Make sure that drag all your prefabs into the scene, run the upgrade tool, then apply changes to all the prefabs. Widgets in 3.0 have width and height rather than using the scale.

Tiles

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 35
    • View Profile
Thanks :)

I will simply stick with 2.7x for my current project. It`s a little bit too challenging for me. The GUI part is finished and working. So no pressure to upgrade really. I may use version 3.x for further projects then :)

sdowd

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1
    • View Profile
Hi,
I'd like to preface this with the fact that I am new to both Unity and to NGUI.  I am working on a project that was previously running with NGUI 2.5.  I upgraded to 2.7 previously without too much of a headache.  In your posts/videos referenced above, I found trying to recognize expected behavior of the 3.0.2 upgrade difficult.

Quote
2.7 to 3.X may be a challenging upgrade, depending on your code and how the UI was used. I've made a video to help, in which I actually go through the process myself and update Starlink UI kit from 2.7 to 3.0. The process for me took about 20 minutes, but I knew what to look for -- so your results may vary.

Make sure that drag all your prefabs into the scene, run the upgrade tool, then apply changes to all the prefabs. Widgets in 3.0 have width and height rather than using the scale.

Your upgrade video starts only after the import has occurred.  Importing 3.0.2 package only calls out 5 files:
"what to import.txt"
"2.7 unity package"
"3.0.2 unity package"
"upgrade tools unity package"
"read me.txt"

Are these items the only updates? 
How would I run the Upgrade tool?

Thanks in advance.
« Last Edit: December 03, 2013, 05:11:37 PM by sdowd »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Don't import 2.7 if you're going to be upgrading to 3.0.

To upgrade, follow the typical steps -- new scene, delete the NGUI folder, import NGUI from the updates package. Now if you had 2.7 before you may also find it useful to import the Upgrade Tools package. After doing this you will be at the same step as I was when starting the video.

triawyn

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 9
    • View Profile
i have followed the instructions, attempted to watch the video, however it does not follow what has actually occurred, so i cannot use it as a reference because now the NGUI window itself is gone from the menu list and, because of the compiler errors, it will not build the editor functions back which are needed to fix the compiler errors associated with the changes to UISlicedSprite among others.  i am now stuck with hundreds of such errors, and:
 
Quote
Assets/Plugins/Editor/UISlicedSpriteInspector.cs(14,40): error CS0246: The type or namespace name `UISpriteInspector' could not be found. Are you missing a using directive or an assembly reference?

where i should be using the upgrade tools in the editor window, which do not exist now.

triawyn

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 9
    • View Profile
ok i fixed all the errors by manualy replacing every instance of UISlicedSprite with UISprite, and changing all the missing mono behaviours accordingly and now the NGUI menu appears.

i still have to go thru all my scripts and fix all uses of localScale now though which will take longer...

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
@triawyn: UISlicedSprite exists in the Upgrade Tools package, and it has a script that lets you auto-upgrade UISlicedSprites to UISprites.

triawyn

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 9
    • View Profile
yes but when there are compiler errors, the NGUI menu in the editor cannot be started because it does not exist yet because the compiler will not run while the errors are present.  so one cannot use the tools before fixing the errors that the tools were made to fix.  vicious cycle kind of thing.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
You don't need the menu to import the upgrade tools package. Once you import the upgrade tools, the compile errors should disappear.