Question by 
               buddahxx · Oct 29, 2017 at 10:28 PM · 
                c#triggerroll a ball  
              
 
              Enemies disappear in test mode
I'm having a problem, when I use this code to move my enemies back and forth, my other 2 enemies aren't visible when I test. Only 1 enemy is showing and it's not even in the location where I assigned it. Any help is appreciated.
using System.Collections; using System.Collections.Generic; using UnityEngine;
 public class Enemycontrol : MonoBehaviour {
 
     public enum OccilationFuntion { Sine, Cosine }
 
     public void Start ()
     {
         //to start at zero
         StartCoroutine (Oscillate (OccilationFuntion.Sine, 1f));
         //to start at scalar value
         //StartCoroutine (Oscillate (OccilationFuntion.Cosine, 1f));
     }
 
     private IEnumerator Oscillate (OccilationFuntion method, float scalar)
     {
         while (true)
         {
             if (method == OccilationFuntion.Sine)
             {
                 transform.position = new Vector3 (Mathf.Sin (Time.time) * scalar, 0, 0);
             }
             else if (method == OccilationFuntion.Cosine)
             {
                 transform.position = new Vector3(Mathf.Cos(Time.time) * scalar, 0, 0);
             }
             yield return new WaitForEndOfFrame ();
         }
     }
 }
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                