hi all.
i need some insights on how to accomplish this…
i already have an array of words… and it is shown in the scene as GUI.Label…
once its being played… words from the array is shown…
now… i need some codes/tips/ideas/etc to do this…
i want the words from the array appear in the scene as individual letters…
so it’ll be like…
ARRAY : BALL, CHICKEN …
in the GUI SCENE : B . A . L . L … C . H . I . C . K . E . N
any kind of help is appreciated…
thanks for your honorable a attention…
flamy
3
//incase it is string array. /declaration/
var length:int=10;
var names:String[]; // some values added to the array from editor, you can add it in code too ur wish
var x=10;
var y=100;
var width=30;
var height=30;
function Start()
{
}
function OnGUI()
{
if(Event.current.type==EventType.Repaint)
{
// to display the seperate letters.
for(var i=0;i<names.Length;i++)
{
for(var j=0;j<names*.Length;j++)*
GUI.Label(Rect(x+jwidth,y+iheight,width,height/x//y//width//height/),“”+names*[j]);*
}
}
}
Update: changed as per @Bunny83 's suggestion
given a string str, you can access each character like an array e.g. str*. Maybe you can start with something like:*
string test = "chicken";
string output = "";
for(int i=0; i<test.Length; i++)
output+=test*+".";*
Debug.Log(output);