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

Error CS0127

$
0
0
Here is my code: using UnityEngine; using System.Collections; public class Difficulty : MonoBehaviour { // Use this for initialization void Start () { } // Update is called once per frame void Update () { GameObject thePlayer = GameObject.Find("_scorer"); score score = thePlayer.GetComponent(); GameObject spawnerobject = GameObject.Find("spawn 1"); spawner spawner = spawnerobject.GetComponent(); if (score.theScore >= 100) { spawner.Difficulty2 (); } return Update(); } } and for the other script: using UnityEngine; using System.Collections; public class spawner : MonoBehaviour { public int Wait_time; public Transform CUBE; // Use this for initialization void Start () { Wait_time = Random.Range (1, 5); StartCoroutine (waiter ()); } // Update is called once per frame void Update () { } IEnumerator waiter() { yield return new WaitForSeconds (Wait_time); spawn(); } void spawn() { Transform temp = Instantiate(CUBE, transform.position,Quaternion.identity) as Transform; StartCoroutine (waiter ()); } public void Difficulty2 () { StartCoroutine (Difficultyset ()); } IEnumerator Difficultyset() { Wait_time = Random.Range (1, 4); spawn (); } } I get this for some reason: Assets/Difficulty.cs(20,17): error CS0127: `Difficulty.Update()': A return keyword must not be followed by any expression when method returns void i have tried taking off the return but then i get this error: Assets/spawner.cs(36,21): error CS0161: `spawner.Difficultyset()': not all code paths return a value I dont have any clue of whats going wrong can someone come up with a solution to this problem. Scott.

Viewing all articles
Browse latest Browse all 2891

Trending Articles



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