Quantcast
Channel: Questions in topic: "error"
Viewing all articles
Browse latest Browse all 7934

Why am I getting this error ? - The type `RandomMovement' already contains a definition for `ChangeRotation'

$
0
0
The following is the code I'm using. I have no other script that has ChangeRotation as a variable that clashes with this one. using UnityEngine; using System.Collections; public class RandomMovement : MonoBehaviour { public float rotationSpeed; public float movementSpeed; public float ChangeRotation; public float rotationTime; void ChangeRotation() { if(Random.value > 0.5f) { rotationSpeed = -rotationSpeed; } Invoke(ChangeRotation,rotationTime); } void Start() { Invoke(ChangeRotation,rotationTime); } void Update() { transform.Rotate (new Vector3 (0, 0, rotationSpeed * Time.deltaTime)); transform.position += transform.up*movementSpeed*Time.deltaTime; } }

Viewing all articles
Browse latest Browse all 7934

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>