|
hey guys. i have a credits level with gui text, a camera and two empty game objects. i want the camera to move down and show the gui text while moving down on its y axis. i also made this c# script: using System.Collections; public class CreditsCamera : MonoBehaviour { public Transform startingTarget; public Transform endingTarget; public float cameraSpeed; // Use this for initialization void Start () { if(startingTarget == null) Debug.LogWarning("There is no starting target for the camera"); if(endingTarget == null) Debug.LogWarning("There is no ending target for the camera"); } // Update is called once per frame void Update () { } } do u think you can help me? c# would be good
(comments are locked)
|
|
I have uploaded a package of the scene and script to here as some of the code doesnt seem to appear properly this is a unity package so should be just import into anywhere and it should run in the editor fine. its running okay. thanks
Jul 03 '12 at 09:51 PM
BakuJake13
(comments are locked)
|
|
Ok so what your doing is basically moving the camera down and displaying the relevant text as required as the camera passes by? If thats what your trying to do what I would do is place all your strings in a array and then update the GUIText as required. You could do it by 1) moving the camera with transform.translate to move the camera slowly down When it moves down a line then do: 2)increment a counter so the game knows you have moved down a line 3)change all the GUIText with the new data from the array 4)move the camera back up then start again (1) keep doing that until you have displayed the entire credits and when thats done reset the line counter so it runs through again OR go back to main menu. The main bonus with doing this is you wont need hundreds of GUIText entries and its easy to change the array than rehashing all the GUIText entries then it is to have hundreds of entries it will also keep the ram requirements of your game down. could you put that in some code? thanks
Jul 03 '12 at 08:00 PM
BakuJake13
I use js is that ok for your project?
Jul 03 '12 at 08:09 PM
EdzUp[GD]
i would use c#, but js is ok too
Jul 03 '12 at 08:10 PM
BakuJake13
Ok I will knock something together for ya, it wont be pretty but it will hopefully explain it enough for you to get a understanding from it :)
Jul 03 '12 at 08:41 PM
EdzUp[GD]
okay. thanks
Jul 03 '12 at 08:57 PM
BakuJake13
(comments are locked)
|
|
Here ya go its not elegant and there are probably hundreds of ways to do it but this way you wouldnt have to have hundreds of GUIText's to scroll through.
(comments are locked)
|

Basically you want to change the transform.position.y of the camera from the startingTarget till it reaches the endingTarget. Right?
right. and as its doing that it shows the gui text