Im making a 3d aim trainer and I recently added a moving platform.
heres the code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TargetRotateX : MonoBehaviour
{
public GameObject target;
public GameObject rotatePoint;
public float rotateSpeed;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
while(true)
{
StartCoroutine(“platformRotate”);
}
}
IEnumerator platformRotate()
{
transform.RotateAround(rotatePoint.transform.position, target.transform.up, rotateSpeed * Time.deltaTime);
yield return new WaitForSeconds(Random.Range(3, 10));
transform.RotateAround(rotatePoint.transform.position, target.transform.up, -rotateSpeed * Time.deltaTime);
}
}
it should change direction every so often but whenever I try to run the project, it freezes and i have to quit the application. help