Question by 
               kewalkishang · Mar 07, 2016 at 04:25 PM · 
                translateviewtransform.translateoffscreen  
              
 
              Character goes out of view the first time it translates.
My character goes out of view when I make it translate for the very first time only, after I enter the game, then it works normally. do any of you have any idea why? I am putting the apk of the game, if you didnt understand what I meant. https://drive.google.com/file/d/0B3ad-0B3guqUcUJqX2dQVWlnUGc/view?usp=sharing.
Thanks.
I am using the unity 5.0.2 personal version. This is the code i am using to move my character. Only the first time into the game he goes out of screen.
 var anim : Animator;
 var effect : Transform;
  var random : int;
 static var score : int; 
  var rb: Rigidbody2D;
  var thePrefab : GameObject;
 public var positions : Vector3[] ;
  
 var lastPosition : Vector3;
 var myTransform : Transform;
 var isMoving : boolean;
 var saasd : int;
 
 function Start () {
 saasd =0;
 Screen.orientation = ScreenOrientation.Portrait;
 anim=gameObject.GetComponent(Animator);
 rb = GetComponent.();
 score=0;
   myTransform = transform;
      lastPosition = myTransform.position;
      isMoving = false;
 }
 function Update() {
 
 if (Input.GetKeyDown(KeyCode.Escape)) 
     Application.LoadLevel(0); 
     
     
  if ( myTransform.position != lastPosition )
           isMoving = true;
      else
           isMoving = false;
  
      lastPosition = myTransform.position;
     // Debug.Log(isMoving);
     if(!isMoving)
     anim.SetFloat("speed",0);
 }
 
 function moveleft() {
 
 saasd=50;
 anim.SetFloat("speed",2);
 transform.Translate (Vector3.left * Time.deltaTime*saasd);
 
 }
 
  
 
 
 function moveright() {
 
 saasd=50;
 anim.SetFloat("speed",-2);
  transform.Translate (Vector3.right * Time.deltaTime*saasd);
 
 } 
 
              
               Comment
              
 
               
              I fixed up your question a little ;)
$$anonymous$$ake sure you just edit your question or add a comment: don't leave an answer if you don't have one.
Your answer