I’ve been diggin’ 'round the forums for a solution to this one, and so far I’ve had no luck.
What I want to do is scroll through large volumes of text on the iPhone while the game it idle. EG: Introduction text, detailed help files, credit lists, etc…
–
What I’ve tried to do…
I’ve tried OnGUI and GUI.x (which can work when the game is idle for other purposes), and SpriteUI (which works great for icons, buttons and bg screens in-game).
I find that using ScrollViewVector in OnGUI “works” - kindov. However, even if I use this method in an isolated script in a unique scene file, the responsiveness on OnGUI is just too slow for User Interaction. The user usually starts moving their fingers on the slider bar, trying to move the slider, before the app has registered the touch properly, so nothing happens most of the time. Often the user will drag at the slider button for several attempts (unless you hold it there and wait) before they “get hold” of the slider. Then once the user has “hold” of the slider button, it’s laggin’ behind the user input.
When trying to use SpriteUI, like all of the SpriteManager children, they don’t play well with text. I’d have to save the text to some large texture, and saving that volume of text to an atlas seems a little stupid, and it doesn’t reproduce (even tho’ it’s supposed to be pixel perfect) as well as the same font in GUI Text.
–
What I’d like to do…
I’d like to just display the text (with some indication that there is more text off screen) and use touch phases to scroll through the text up or down depending on the user’s finger movement.
I could imagine having a large GUI Text object and trying to watch for the touches and applying that to an axis on a GUI Text camera so the camera runs up and down the text…
… but before I go and reinvent the wheel, I’d like to know if anyone else has solved this.
If not done disable the guilayout, it should help quite a bit on the performance end
Pixel Perfect: I assume you disabled compression, otherwise you won’t get any pixel perfect images.
Personally: I would use textures with the text already present and switch through them / have a GUITexture and a master game object that I just move up / down according the finger movement.
Gives me more control over the styling too.
The “pixel perfection” I find (with basic testing, nothing extensive) seems to be that Photoshop is imperfect in the way it handles displaying text, and Unity seems imperfect in how it imports the texture (using either tiff or psd files with no compression), combining to a slightly degraded look to the “text-saved-as-image” compared to the “text-rendered-by-unity”. It’s hardly noticeable, but it’s there.
Textures imported in Unity iPhone by default use PVR texture compression which yis granted to kill pixel perfectness (unless you don’t have alpha and you use BPP4 where you have a given chance that it will remain as it used to be), so ensure to set the right compression
iirc: I’m using RGBA 32bit as the import setting… which would make the asset about 4mb? but it’s clean.
4MB only on a 1024x1024 which for scrolling texts doesn’t make any sense as you don’t have a screen width of 1024 
I would potentially look into 256x512 or 256x1024 blocks for example. (wouldn’t use smaller blocks as draw calls otherwise can become kind of troublesome as well as the continous load / bind / unload of textures)
That also would be only 1/8 or 1/4 of the size.
As you don’t use compression, there is no problem with the non square situation.
Also, you can disable mipmapping if you align it to be pixel perfect in size (so 1:1 ratio)
(Not wanting to Hijack my own thread, but, Photoshop is notorious for text being a runt in the stable of photoshop assets and abilities, and Unity has some wonky things with it’s input - like the black fringe on alphas from tiff files and the white fringe on alphas from .psds… You can see this in the inspector when you compare the files, as Unity seems to make the transparent area BLACK on tiffs, and WHITE on .psd’s… Go figure…)
Any tho’ts on the best way to detect user input and apply that to text?
[edit] Whoops! Cross posted! ~.^
(Yeah, mip maps, bump maps, cube maps are all off, it’s just a thing… not very noticeable but present. Before my Film TV career I was in DTP, and photoshop was never great at text…)
(1024 v/v 320… You’d run the text in strips and UV map your textures, or use a SpriteUI style manager and pull texture strips onto a sprite… But with SpriteUI I’d have to dig around and see what it was doing with touchMoved, and I’m not sure how I’d join up a strip if it exceeded the 1024 in length…)
Unity takes what is beeing input. Unlike most other applications it even reads the meta data on psd and png etc, which can have an impact. I personally use SuperPNG to store my textures, as it is, unlike Adobes own stuff, not totally broken (which is a shame, they bought macromedia and are still incapable to write a somewhere correct png saver)
Perhaps Photoshop will stop doing this stuff by CS 25
Also for the background, the shader is of large importance, because without an alpha shader you lose the alpha channel on the texture and the real color without alpha thats beeing applied by photoshop appears (it always has a color).
For the user input: I think your idea above should work pretty well with the touch phases and the touch deltas. use the delta y value and you know if you want to scroll up or down
Using textures seems pretty wasteful to me, especially if you want to localize the game easily without massively bloating the file size, plus it’s easier to edit the text as text. Just write the text using GUIText and make a routine for scrolling it. You can see this when scrolling high scores in Realmaze3D…I made it pretty similar to the standard iPhone scrolling, with the “coasting” and rubber banding at the limits.
–Eric
Eric:
(^_^) Whoops! I wasn’t trying to say I’d actually use textures, but was suggesting that if you did import a full 1024^2 atlas, you could use the entire real estate on the iPhone by using strips…
Hello,
Just curious if anyone has a basic iPhone touch to scroll up and down script. (This could either move the camera or just what item the script was attached to) Finger manage the scrolling up and down.
Cheers,
McKaners 
McKaners:
This is a place to start:
function Update () {
if (iPhoneInput.touchCount > 0) {
var touch : iPhoneTouch = iPhoneInput.GetTouch (0);
if (touch.phase == iPhoneTouchPhase.Moved) {
var touchPositionDeltaY = touch.deltaPosition.y;
}
}
}
It’s not full working code by any means, but it looks at the touch and sees how it’s moved. You can use touchPositionDeltaY to move the block of text you need to move. There will be more code to wrap around both the text and touchPositionDeltaY, but this could get you started. Look up the bits in the docs, like “…Documentation/ScriptReference/iPhoneTouch.html” and “…Documentation/ScriptReference/iPhoneInput.html” to give you a hand. And look at OnGUI and GUI.x as well, as I’m presuming you’ll be needing text in non-performance critical moments, like menus, and can afford to use the built in Unity GUI.
Also, look at “… Documentation/ScriptReference/GUI.Window.html” for creating GUI Windows. This will give you a place to put your text block.
I’ve found that editing text in a text editor and then importing it as a text asset is a good pipeline.
Start with something like:
var myTextAsset : TextAsset;
private var myText : String;
function Start () {
myText = myTextAsset.text;
}
Drag your text file onto the exposed myTextAsset variable in the inspector. When you hit “play”, function Start() will assign the text in your text asset to your String variable.
Then you can use the String variable when defining your block of text.
Let me know how it goes.
Ok - try this:
http://theantranch.com/Unity/Unity.html
I’ve put up an example project and explanation on how to scroll text using gestures. This example used OnGUI and GUI.x, so it’s only meant for not frame rate critical parts of your game.
I’ve posted this in its own thread here:
http://forum.unity3d.com/viewtopic.php?p=277992