Author Topic: Best Way To Handle Slide Show With Many Slides  (Read 5506 times)

DevMan5000

  • Newbie
  • *
  • Thank You
  • -Given: 4
  • -Receive: 0
  • Posts: 22
    • View Profile
Best Way To Handle Slide Show With Many Slides
« on: June 25, 2014, 10:02:46 AM »
Hello,

I am doing a slide show presentation. Basically, its a scroll view with 30 full screen slides.

I'm a newbie to Unity. What is the best way to implement something like this?

My concern is that if I just put all 30 slides in the editor view, then all those textures will be loaded at once and decrease perf when I am running.

1. Should I only keep 3 slides loaded at a time (left offscreen, onscreen, and right offscreen) and dynamically load/unload slides once the slide snaps to the center?

2. Should I be making these slides prefabs? Once I do, is there a way to update prefab (e.g. I drag a prefab on the stage, move/add elements, and then make these changes part of the prefab in the toolbar)?

Thanks

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Best Way To Handle Slide Show With Many Slides
« Reply #1 on: June 26, 2014, 09:34:17 AM »
1. Have a look at the endless scroll view example done using UIWrapContent. You can derive from that script to set your data dynamically (UpdateItem function).

2. I'm not sure what the toolbar has to do with anything. Do you mean the prefab toolbar? Any changes you make to the prefab will be reflected in the thumbnail after you hit Play.

DevMan5000

  • Newbie
  • *
  • Thank You
  • -Given: 4
  • -Receive: 0
  • Posts: 22
    • View Profile
Re: Best Way To Handle Slide Show With Many Slides
« Reply #2 on: August 13, 2014, 08:26:32 PM »
"Do you mean the prefab toolbar? Any changes you make to the prefab will be reflected in the thumbnail after you hit Play."

Yes, I'm referring to the prefab tool bar. So lets say I create a label and attach a child sprite. I drag that onto a prefab slot. Now, I decide that I want another child sprite on that prefab.

1. What do I have to do to "update" the prefab in the toolbar such that when I pull one off, it will have the label and two child sprites? Is it a matter of dragging that prefab into the scene, adding the additional sprite, and then dragging that whole thing back onto the toolbar, thus overwriting the previous one?

2. Lets say I have a used a ton of a specific prefab throughout my project. Now I want to update them all. Is there an easy way to propagate a change or do I have to update the prefab and then go to each instance in my scene and delete the old prefab instance and drag a new one on?

Thanks

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Best Way To Handle Slide Show With Many Slides
« Reply #3 on: August 14, 2014, 07:34:31 AM »
1. Just apply changes to the prefab. if you have the UISnapshotPoint script attached, you can click its button to update the preview right away. Just note that that script should be on a child object, not on the root object. It lets you position and size the snapshot camera.

2. Same... apply changes to the prefab will update them all. I'm not sure if I understood you correctly as prefabs are a basic Unity concept.

DevMan5000

  • Newbie
  • *
  • Thank You
  • -Given: 4
  • -Receive: 0
  • Posts: 22
    • View Profile
Re: Best Way To Handle Slide Show With Many Slides
« Reply #4 on: August 14, 2014, 05:13:32 PM »
thanks for your response, but I'm sorry, I must be just missing something very basic. I'll write out what I am doing and maybe you can spot what I am missing.

1. Create Label
2. Drag from hierarchy view into an "Add" slot on prefab toolbar. Call it MyPrefab
3. Delete the Label from the scene.
4. Drag 2 instances of MyPrefab off the tool bar and place them in the scene.
5. Add a Sprite as a child to the first instance of MyPrefab
6. Notice how the second instance does not "update" to also have a child sprite.
7. Drag a third instance of MyPrefab off the tool bar and place it in the scene.
8. Notice the third instance does not have the sprite either meaning that the prefab in the toolbar did not "update" to include a sprite.

So, could you please tell me what I am missing here, because I don't see these guys updating. You mention "apply changes to the prefab", is that a button I click somewhere? Adding a sprite to a prefab instance on the stage definitely did not propagate that sprite to all instances of the prefab.

I gauge from your response that this is dead simple, but because I am brand new to Unity and NGUI I am totally missing the big picture here.

Thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Best Way To Handle Slide Show With Many Slides
« Reply #5 on: August 15, 2014, 07:36:23 AM »
#6 doesn't update because you need to click the Apply button at the top of the inspector window. If you don't see that button, select the actual prefab (blue color item in the hierarchy view).

That's how you work with prefabs. It's a basic Unity concept, and not an NGUI question. Consult Unity's documentation on how prefabs work.

DevMan5000

  • Newbie
  • *
  • Thank You
  • -Given: 4
  • -Receive: 0
  • Posts: 22
    • View Profile
Re: Best Way To Handle Slide Show With Many Slides
« Reply #6 on: August 30, 2014, 03:32:06 PM »
Sorry for the confusion. I'm just getting my feet wet around these parts. Thanks much!