unity遇到的问题

unity遇到的问题

实现需求-----开门的脚本

按下z键就会开门 抬起就会关门,使用组件 Transform.Rotation(vector float)

使用transform组件的rotate的(轴,旋转度数)

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
​
public class opendoor : MonoBehaviour
{
    private Transform m_transform;
    // Start is called before the first frame update
    void Start()
    {
        //获取transform组件
        m_transform = gameObject.GetComponent<Transform>();
    }
​
    // Update is called once per frame
    void Update()
    {
        if (Input.Getkeydown(keyCode.z))
        {
            //opend
            OpenDoor();
        }
        if(Input.GetKeyUP(KeyCode.z))
        {
            //close
            CloseDoor();
        }
    }
    void OpenDoor()
    {
        m_transform.Rotate(vector3.up, 90);
    }
    void CloseDoor()
    {
        m_transform.Rotate(vector3.up, -90);
    }
}
​

导入的fbx格式的不同物件

cannot restructure prefab instance chdren of aprefabnstance camotbe deeted ormoved, and components cannot be reordered,you can unpack the prefab instance to remove itsprefab conmection. ok

报错

但是无法编辑单独物件


解决方案

在预制体右键 解除

需要解除预制体的

怎么移动轴心??

直接新建空物体,然后直接在privot的模式,移动空物体的轴心,移动好位置在 再拉子物体进来

怎么设置游戏的摄像机机

新建摄像机

然后自场景screen的地方直接调节摄像机的位置

再回到game游戏的窗口看一下

怎么使用till瓦片贴图

新建一个planer

然后新建一个材质

接着使用贴图

vs编辑unitu的c#显示不兼容

VS 下载unity的插件但是还是不行

明天看看是否是.net不兼容还是什么???

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值