汐汐沐
2022-04-28 14:40
采纳率: 100%
浏览 55

在unity的c#脚本的错误

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class player : MonoBehaviour
{ public float movespeed=3;
private SpriteTenderer sr;

public Sprite[] tankSprite; 
private void Awake()    //只有这里是错误,提示需要加分号,但是加分号后还是有错误

img

void Start()
{
    sr = GetComponent<SpriteTenderer>();
}

// Update is called once per frame
void Update()
{
    float h = Input.GetAxisRaw("Horizontal");
    transform.Translate(Vector3.right * h * movespeed * Time.deltaTime, Space.World);
    if(h<0)
    {

    }
    float v = Input.GetAxisRaw("Vertical");
    transform.Translate(Vector3.up * v * movespeed * Time.deltaTime, Space.World);

}

}

2条回答 默认 最新

相关推荐 更多相似问题