error CS1513: } expected (error CS1022: Type or namespace definition, or end-of-file expected) (csscript)
Closed this issue · 3 comments
error CS1513: } expected (error CS1022: Type or namespace definition, or end-of-file expected) (csscript)
Code
//css_ac
//css_import Use.cs
//css_reference System.Data.Linq.dll
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.Linq.SqlClient;
namespace Folder_NS_02
{
public class Test
{
public void main(string[] args)
{
User myClassTest = new User();
var exceptonList = new[] { "ToString", "Equals", "GetHashCode", "GetType", ".ctor" };
var members = myClassTest.GetType().GetMembers()
.Select(x => x.Name)
.Except(exceptonList);
}
}
}
The problem is caused by the fact that you specify auto-class option (//css_ac
) and it is trying to wrap your script into a class definition but... you are already using the class (Test
).
So either remove //css_ac
or clean your script as :
//css_ac
//css_imp Use.cs
//css_ref System.Data.Linq.dll
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.Linq.SqlClient;
void main(string[] args)
{
User myClassTest = new User();
var exceptonList = new[] { "ToString", "Equals", "GetHashCode", "GetType", ".ctor" };
var members = myClassTest.GetType().GetMembers()
.Select(x => x.Name)
.Except(exceptonList);
}
I'm getting the same error with my code when i try to make player movement for Unity normally it works but I'm not on the normal computer i use and now I'm getting this error I've copied and pasted my code bellow i was wondering if your solution would work for me. Thanks in advance for the help
code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Testplayer : MonoBehaviour
{
public float speed;
private Rigidbody2D teriyaki;
// Start is called before the first frame update
void Start()
{
speed = 5f;
teriyaki = gameObject.GetComponent<Rigidbody2D>();
}
// Update is called once per frame
void Update()
{
private float vert = Input.GetAxisRaw("vertical");
}
// this is ot do things whiht the physics engine
void FixedUpdate()
{
if (vert > 0.1f)
{
teriyaki.AddForce(new Vector2(0f, vert * speed), ForceMode2D.Impulse);
}
}
}
What are you trying to do with that Testplayer
class?
I can see you cannot execute it. It is expected. So what exactly is the problem and how do you trigger it?