transform.localPosition获得本地坐标,然后修改本地坐标为(0,0.5f,0)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SimpleLogic : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
GameObject obj = this.gameObject;
obj.transform.localPosition = new Vector3(0,0.5f,0);
}
// Update is called once per frame
void Update()
{
}
}