Author Topic: Example Atlas destroyed  (Read 5293 times)

George

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 8
    • View Profile
Example Atlas destroyed
« on: February 18, 2014, 04:30:26 PM »
I am using NGUI in Unity3D and I needed to be able to set label values from code. The NGUI install does setup up properly in Unity so that NGUI classes like UILabel can be seen by the compiler, so I had to move all the NGUI code (except Editor) to Plugins/NGUI.  NGUI now works in in Unity fine.  This move killed all my existing NGUI work which had to redone because the script had been moved loosing script references and settings. This change also killed all the NGUI examples and the NGUI example atlases (which use UIAtlas).

I cannot find or figure out how to recreate the example atlases.  The NGUI atlas tool seems to let you create an atlas from singular images but not from an atlas image.  How can I create an the different example atlases from the atlas images?

George

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 8
    • View Profile
Re: Example Atlas destroyed
« Reply #1 on: February 18, 2014, 05:24:12 PM »
So, if I add the UIAtlas script to the atlas gameobject then I have add the material for the atlas but the TP Import file does not seem to be in the example atlas folder to possibly finish the atlas.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Example Atlas destroyed
« Reply #2 on: February 19, 2014, 12:18:08 PM »
You can't move assets outside of Unity. If you move something, it has to be done from inside of Unity.

Moving anything outside of Unity breaks all references unless you have visible metadata enabled. This is how Unity works.

George

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 8
    • View Profile
Re: Example Atlas destroyed
« Reply #3 on: February 19, 2014, 12:38:23 PM »
I moved the code within Unity as I was instructed by other posts when I had the more important problem of my C# code complied with UILabel working. All NGUI is placed in Assets.  The code base should be place in Assets/Plugins/NGUI where the compiler will look for other tools code.  If it was in Plugins, the project and the examples could both use the code.

By moving the code to solve a basic requirement of using NGUI classes in my code, it broke all the references in the examples - the code cannot exist is two places.

My questions is, how do it get the example atlases working again. There is no TP Import file included in the sample atlas folders.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Example Atlas destroyed
« Reply #4 on: February 19, 2014, 03:47:04 PM »
The code cannot exist in two places? By the definition when you move something, you don't leave a copy behind.

I would suggest deleting NGUI and importing it fresh from the package and making sure you follow http://www.tasharen.com/forum/index.php?topic=6.0

George

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 8
    • View Profile
Re: Example Atlas destroyed
« Reply #5 on: February 19, 2014, 04:46:16 PM »
I did not leave it (the project will not compile if you do), I moved it as the link says. I was that page that I followed to fix the problem of using NGUI classes in my code, but it breaks the examples.  If NGUI would install to Plugins in the first place the problem could be would not happen.

By moving the code then all the code placed on the examples game objects is lost including the atlases. If you put the code back on the example objects none of the parameters are restored.  I put the UIAtlas code file back along with an example atlas but it still needs the TP Import value filled in and there is no file for that, I cannot get the atlas working again without it.

Please, can anyone provide the TP Import files for the example atlases or tell me how to do get an example atlas working without the TP Import setting.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Example Atlas destroyed
« Reply #6 on: February 20, 2014, 08:44:22 AM »
As I mentioned, Unity keeps references to scripts internally, and if the references get lost, it can always be traced back to moving something from A to B either outside of Unity, or in some other fashion where Unity was not able to update them. This is just how Unity works, and is one of those things that every single user has run into at some point or another in their dev lives, myself included

You can try it in a new project -- import NGUI, then follow the steps in the FAQ post I linked. Everything will work, and all references will be kept.

Also note that you need to start a clean scene before doing any of this. If you have any scene open that's using NGUI, things may not work properly. This is why the upgrade process explained in the readme file is a 3 step process:

1. New scene
2. Delete NGUI
3. Import NGUI

George

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 8
    • View Profile
Re: Example Atlas destroyed
« Reply #7 on: February 20, 2014, 05:04:58 PM »
It worked! but my own NGUI objects lost all their scripts.  On the positive side, where I managed to the put the right ones back the values where remembered - messed up on a couple.  I did save my project so I was able to reference the values. This was the second time I needed to do this since I already had NGUI objects when I moved the NGUI code to Plugins the first time.  Interestingly, the samples now look like they are supposed to, they looked quite awful before.

Probably be simpler and more correct for NGUI to put the code in PlugIns in the first place in the import since it is likely your users will have already done some work before finding the code reference problem which is then potentially lost like happened to me twice.  I wrote an Asset Store product that installs to Plugins.

Thanks very much and sorry for being so dense concerning the 'only do it with a new scene' part.  My project looks much better using your graphics in my NGUI interface while I wait for our graphics team to produce something.