I don’t understand how you’re creating a scrolling background with this, but just as a note, comparing strings will be slower than comparing the transforms ( it will also cause garbage collection to fire frequently in your example )
function Update ()
{
this_ref_transform.position.x = camera1.position.x;
if(Physics.Raycast(this_ref_transform.position,Vec tor3(0,0,100),hit))
{
var hitTransform = hit.transform;
In this very case i have three planes used as background which are placed on after another in positive x-axis and my character is also move in positive x-axis … when my character reach at third plane starting which is “Middle_Cube3” then i change the position of first plane which is “Middle_Cube1” in this way it appear as background is scrolling/moving
I don’t understand why you’re raycasting and comparing string.
You know the positions of the planes and of the player, just move the transform of the various planes when the player reach a certain position, then rinse and repeat.
Watch out for the overdraw, if you have three transparent plane covering the entire screen, you’re really pushing it on iPhone 4 and iPad 1.