- Home /
 
               Question by 
               georgemigde · May 30, 2019 at 03:19 PM · 
                2dspritespriterenderer  
              
 
              My gameObject is invisible
Hello,
I wrote a script for moving a 2D Platform:
 public class PlatformMove : MonoBehaviour
 {
     private Vector3 posA;
 
     private Vector3 posB;
 
     private Vector3 nexPos;
     [SerializeField]
     private float speed;
     [SerializeField]
     private Transform childTransform;
     [SerializeField]
     private Transform transformB;
 
     // Start is called before the first frame update
     void Start()
     {
         posA = childTransform.localPosition;
         posB = transformB.localPosition;
         nexPos = posB;
     }
 
     // Update is called once per frame
     void Update()
     {
         Move(); 
     }
 
     private void Move()
     {
         childTransform.localPosition = Vector3.MoveTowards(childTransform.localPosition, nexPos, speed * Time.deltaTime);
 
         if(Vector3.Distance(childTransform.localPosition, nexPos) <= 0.1)
         {
             ChangeDestination();
         }
     }
 
     private void ChangeDestination()
     {
         nexPos = nexPos != posA ? posA : posB;
     }
 }
The problem is that I can't see my gameObject with the sprite attached to it. It's visible in the scene viewer but in the actual game window, it's gone.
Thank you for your help
               Comment
              
 
               
              Your answer
 
 
             Follow this Question
Related Questions
How the change the sprite image of spritemask according to the sprite image in that object animator? 0 Answers
Changing one keyframe in my animation changes all of them 2 Answers
Displaying Prefab Sprite as Texture on GUI Elements 0 Answers
hide animated Sprite by code (SpriteRenderer) 2 Answers
[2D] [C#] Sprite disappears after changing position 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                