I am currently trying to test different rotations before beginning the game and i would like my move() method to run for a longer time than it for the processor to process it. Here is the code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerController : MonoBehaviour
{
[SerializeField] private float speed;
Quaternion[] Rotation;
Vector3 Rotate;
public bool loading = false;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
Move();// How do i make this run longer without putting it in the update method
}
public void Loading()
{
float i;
loading = true;
Tester();
for(i = 0; i <= Rotation.Length; i++)
{
// i will fill this later with other code
}
}
void Tester()
{
Rotate = new Vector3(0, 0, 0);
Rotation[0] = Quaternion.Euler(Rotate);
Rotate = new Vector3(0, 0, 90);
Rotation[1] = Quaternion.Euler(Rotate);
Rotate = new Vector3(0, 0, -90);
Rotation[2] = Quaternion.Euler(Rotate);
Rotate = new Vector3(0, 0, 180);
Rotation[3] = Quaternion.Euler(Rotate);
}
void Move()
{
transform.position += transform.right * speed * Time.deltaTime;
}
}