首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >获取另一个脚本时的C#问题

获取另一个脚本时的C#问题
EN

Stack Overflow用户
提问于 2020-05-14 23:25:58
回答 1查看 17关注 0票数 0

因此,我一直在关注Youtube上关于围栏搭建的教程,我已经做了所有的事情。唯一的问题是它现在不能工作了,两个函数说我的一个变量指针没有定义它们,尽管在教程中它是工作的,这是我的脚本

代码语言:javascript
复制
using System.Collections;
using System;
using System.Collections.Generic;
using UnityEngine;
using System.Reflection;

public class CreateFence : MonoBehaviour
{
    public int Building = 1;
    bool creating;
    ShowMousePosition Pointer;
    public GameObject polePrefab;
    public GameObject fencePrefab;
    // Start is called before the first frame update
    void Start()
    {
        Pointer = GetComponent<ShowMousePosition>();
    }



    // Update is called once per frame
    void Update()
    {

    }
    void getInput()
    {
        if(Input.GetMouseButtonDown(0) && Building == 1)
        {
            startFence();
        }
        else if (Input.GetMouseButtonUp(0))
        {
            setFence();
        }
        else if (creating)
        {
            updateFence();
        }
    }
    void startFence()
    {
        creating = true;
        Vector3 startpos = System.Reflection.Pointer.getWorldPoint();///getWorldPoint says Pointer has no definition for it
        startpos = System.Reflection.Pointer.snapPosition(startpos);///snapPosition says Pointer has no definition for it
    }
    void setFence()
    {
        creating = false;
    }
    void updateFence()
    {

    }
}
EN

回答 1

Stack Overflow用户

发布于 2020-05-15 02:10:36

所以我弄清楚了,这是系统反映的问题,显然unity自动纠正了我的错误,Apple = Microsoft Visual Studios

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61801218

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档