Help, my code shows me an error, could you help me? I’ve only been in my class for 2 days
From
“// Update is called”
until the end it gives me an error
using UnityEngine;
using System.Collections;
public class BehaviourTrainning : MonoBehaviour {
public bool vaALover = true;
// Use before
void Awake () {
Debug.Log (“Awake class”);
}
// Use this for initialization
void Start () {
Debug.Log(“Class open”);
if (vaALover) {
Debug.Log(“Have”);
}else {
Debug.Log (“No have”);
}
// Update is called once per frame
void Update () {
Yoreki
February 23, 2021, 1:40am
2
Start by using code tags to post code, and posting the error message
1 Like
^ Definitely do those things to get better help, but I can in this case tell at a glance that you are missing a close bracket after the previous function. So as far as the compiler is concerned you’re still inside Awake() { } when you try to declare Update(), and since you can’t put a function inside another function, error.
1 Like
I’ll chime in here too while we’re all in a mind to make this a better place!
This is how to report your problem productively in the Unity3D forums:
http://plbm.com/?p=220
How to understand compiler and other errors and even fix them yourself:
https://discussions.unity.com/t/824586/8
If you post a code snippet, ALWAYS USE CODE TAGS:
How to use code tags: https://discussions.unity.com/t/481379
1 Like