You have some wayward curly braces. Right now, SpawnPowerUpRoutine is inside of SpawnEnemyRoutine. Take a look around and count the curly braces. You should be able to spot the problem then.
Edit:
If you are working in Visual Studio, this shortcut combo will format the current document and help make the problem clearer.
ctr+a
ctr+k,f â Hold the control key, then press k followed by f while keeping control down
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using JetBrains.Annotations;
using Unity.Collections;
using UnityEngine;
using UnityEngine.Assertions;
using Debug = UnityEngine.Debug;
public class player : MonoBehaviour
{
private bool jumpKeyWasPressed;
private float horizontalInput;
private Rigidbody rigidbodyComponent;
private bool isGrounded;
// Start is called before the first frame update
void Start()
{
rigidbodyComponent = GetComponent();
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
jumpKeyWasPressed = true;
}
Please donât necro-post. You likely just have typos but nobody can read your code because you failed to format it properly. Hereâs how to fix your typing mistakes:
Remember: NOBODY here memorizes error codes. Thatâs not a thing. The error code is absolutely the least useful part of the error. It serves no purpose at all. Forget the error code. Put it out of your mind.
The complete error or warning message contains everything you need to know to fix the error yourself.
The important parts of the error message are:
the description of the error itself (google this; you are NEVER the first one!)
the file it occurred in (critical!)
the line number and character position (the two numbers in parentheses)
also possibly useful is the stack trace (all the lines of text in the lower console window)
Always start with the FIRST error in the console window, as sometimes that error causes or compounds some or all of the subsequent errors. Often the error will be immediately prior to the indicated line, so make sure to check there as well.
All of that information is in the actual error message and you must pay attention to it. Learn how to identify it instantly so you donât have to stop your progress and fiddle around with the forum.
When you have an actual problem that isnât just inaccurate typing, here is how to report your problem productively in the Unity3D forums: