【发布时间】:2020-03-05 14:56:53
【问题描述】:
我是编码新手,根据我收集到的信息,编写以下代码是为了与 C# 4.0 而不是当前版本兼容。还有一个我无法在标题中出现的错误: 令牌无效 ';'在类、结构或接口成员声明中
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class camera_controller : MonoBehaviour
{
public GameObject player;
private Vector3 offset;
Vector3 offset = transform.position;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
void LateUpdate ()
{
transform.position=player.transform.position+offset;
}
}
【问题讨论】:
-
我是编码新手 那么你应该从学习一些 C# 基础知识开始......我敢打赌你把这段代码直接放在类体而不是方法体中......但是没有MVCE只是瞎猜
标签: c# unity3d syntax-error