Hi,
For some reason my coroutine is not working. I want to be able to access it over different scripts. Here is the full PlayerMovement.cs :
`using UnityEngine;
using System.Collections;public class PlayerMovement : MonoBehaviour
{
// Change in Position Varaibles
private static Vector3 lastPosition;// Values are set in Unity3D Interface
public static float MoveSpeed = 40,
RotateSpeed = 200
;public static float MoveForward,
MoveRotate
;
public static IEnumerator Move_Player()
{
MoveForward = Input.GetAxis(“Vertical”) * MoveSpeed * Time.deltaTime;
MoveRotate = Input.GetAxis(“Horizontal”) * RotateSpeed * Time.deltaTime;// Move the player transform.Translate(Vector3.forward * MoveForward); transform.Rotate(Vector3.up * MoveRotate); if (Vector3.Distance(lastPosition, transform.position) > 0.01f) { lastPosition = transform.position; StartCoroutine(PlayerParticles.DestroyParticles()); } yield return 0;
}
`
}
I am getting several errors regarding non-static fields, methods or properties, the object 'transform' does not contain a defintion for 'position' and so on. This is strange because the code works as it already is but only within the script that the method (Move_Player) is in. I can see that the coroutines need something more..