简体   繁体   English

"Unity 包错误“找不到命名空间的类型”"

[英]Unity Package Error "the type of namespace could not be found"

Hi i'm using unity package called "Movement Animset Pro v1.693.unitypackage" for unity character moving when i import package in unity all thins goes fine except the script file it gives me errors all over the code i'm using the last unity version and here is the code嗨,我正在使用名为“Movement Animset Pro v1.693.unitypackage”的统一包来移动统一角色,当我在统一中导入包时,除了脚本文件之外,它在我使用的最后一个代码中都给了我错误统一版本,这是代码

\/\/ (c) Copyright HutongGames, LLC 2010-2011. \/\/ (c) 版权所有 HutongGames, LLC 2010-2011。 All rights reserved.版权所有。

    using UnityEngine;

    namespace HutongGames.PlayMaker.Actions
    {


[ActionCategory(ActionCategory.Transform)]
[Tooltip("Moves a Game Object towards a Target. Optionally sends an event when successful. Optionally set when to update, during regular update, lateUpdate or FixedUpdate. The Target can be specified as a Game Object or a world Position. If you specify both, then the Position is used as a local offset from the Object's Position.")]
public class MoveTowards2 : FsmStateAction
{
    public enum UpdateType {Update,LateUpdate,FixedUpdate};

    [RequiredField]
    public FsmOwnerDefault gameObject;

    public FsmGameObject targetObject;

    public FsmVector3 targetPosition;

    public FsmBool ignoreVertical;

    [HasFloatSlider(0, 20)]
    public FsmFloat maxSpeed;

    [HasFloatSlider(0, 5)]
    public FsmFloat finishDistance;

    public FsmEvent finishEvent;

    public UpdateType updateType;


    public override void Reset()
    {
        gameObject = null;
        targetObject = null;
        maxSpeed = 10f;
        finishDistance = 1f;
        finishEvent = null;
        updateType = UpdateType.Update;
    }

    public override void OnUpdate()
    {
        if (updateType == UpdateType.Update)
        {
            DoMoveTowards();
        }
    }

    public override void OnLateUpdate()
    {
        if (updateType == UpdateType.LateUpdate)
        {
            DoMoveTowards();
        }
    }

    public override void OnFixedUpdate()
    {
        //if (updateType == UpdateType.FixedUpdate)
        //{
            DoMoveTowards();
        //}
    }

    void DoMoveTowards()
    {
        var go = Fsm.GetOwnerDefaultTarget(gameObject);
        if (go == null)
        {
            return;
        }

        var goTarget = targetObject.Value;
        if (goTarget == null && targetPosition.IsNone)
        {
            return;
        }

        Vector3 targetPos;
        if (goTarget != null)
        {
            targetPos = !targetPosition.IsNone ? 
                goTarget.transform.TransformPoint(targetPosition.Value) : 
                goTarget.transform.position;
        }
        else
        {
            targetPos = targetPosition.Value;
        }

        if (ignoreVertical.Value)
        {
            targetPos.y = go.transform.position.y;
        }

        go.transform.position = Vector3.MoveTowards(go.transform.position, targetPos, maxSpeed.Value * Time.deltaTime);

        var distance = (go.transform.position - targetPos).magnitude;
        if (distance < finishDistance.Value)
        {
            Fsm.Event(finishEvent);
            Finish();
        }
    }

}
}

As the error says the program doesn't find the names like 'FsmStateAction', look into your assets for that name and find the script that contains it, then put the namespace of the script at the top of your code like: 如错误所示,程序找不到“ FsmStateAction”之类的名称,请在您的资产中查找该名称,并找到包含该名称的脚本,然后将该脚本的名称空间放在代码顶部,例如:

using someNamespace;

I can see that you have some errors of override, you cannot override this methods if they aren't virtual, check the code of the package before you make your own. 我可以看到您有一些覆盖错误,如果这些方法不是虚拟的,则不能覆盖此方法,请在制作自己的方法之前检查软件包的代码。

Hi you found any solution?嗨,您找到任何解决方案了吗? i have the same problema我有同样的问题

"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何统一修复“找不到类型或命名空间名称”错误? - How to fix 'The type or namespace name could not be found ' error in unity? Unity 构建错误:找不到类型或命名空间名称“Editor” - Unity build error: The type or namespace name 'Editor' could not be found 统一中找不到类型或命名空间名称“Rigidbody2d”错误 - The type or namespace name 'Rigidbody2d' could not be found error in unity Unity:找不到类型或名称空间名称“功能” - Unity: The type or namespace name 'function' could not be found 找不到类型或命名空间名称 Unity - The type or namespace name could not be found Unity 找不到类型或命名空间名称“NUnit”| 统一 - The type or namespace name 'NUnit' could not be found | Unity 找不到类型或命名空间名称“...” - Unity Vuforia - The type or namespace name "..." could not be found - Unity Vuforia 将 DLL 导入 Unity - 找不到类型或命名空间 - Importing DLL into Unity - Type or namespace could not be found Unity引发错误“ CS0246:找不到类型或名称空间名称&#39;SharpKml&#39; - Unity throws an error “CS0246: The type or namespace name ‘SharpKml’ could not be found “找不到类型或名称空间名称。 您是否缺少程序集参考?” Unity中的错误 - “The type or namespace name could not be found. Are you missing assembly reference ?” Error in Unity
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM