Hi I’m in a game jam, i only have 4 days ,
Here is the error and code.
CODE:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NewBehaviourScript : MonoBehaviour
[new {System.Steriallizable}]
{
[SteriallizeField] private Transform player;
[SteriallizeField] private Transform respawnPoint;
void OnTriggerEnter(Collider other)
{
player.transform.position = respawnPoint.transform.position;
}
}
ERROR: Assets/Respawn.cs(6,2): error CS0270: Array size cannot be specified in a variable declaration
(try initializing with a 'new' expression)
We don’t need the code! Luckily 100% of what you need is in the error.
How to understand compiler and other errors and even fix them yourself:
https://discussions.unity.com/t/824586/8
Remember: NOBODY memorizes error codes. The code is absolutely the least useful part of the error.
The important parts are: the description of the error itself, the file it occurred in, and the line number and character position.
All of that information is in the actual error message and you must pay attention to it.
Line 6 above looks extremely suspicious to me. Review how you arrived at that solution. Not only that you are misspelling things in there, and you need to rename your NewMonoBehaviour AND your file.
Slooooooooow down my friend. Speed NEVER pays, even in game jams. Trust me: I jam every day.
Thank you.
i might just settlle on remaking the script