RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / user-612787

Anick's questions

Martin Hope
Anick
Asked: 2024-12-31 11:51:04 +0000 UTC

在Unity中使用DoTWeen时出错

  • 4

我有一个使用 DoTween 为窗口及其元素设置动画的脚本。但是控制台有一个我不明白的错误:

UnityException:不允许从 MonoBehaviour 构造函数(或实例字段初始值设定项)调用 get_isPlaying,请改为在 Awake 或 Start 中调用它。从游戏对象“Button(Legacy)”上的 MonoBehaviour“FadePanel”调用。有关详细信息,请参阅 Unity 手册中的“脚本序列化”页面。 DG.Tweening.DOTween.InitCheck () (位于 D:/DG/_Develop/__UNITY_ASSETS/_Demigiant/__DOTween/_DOTween.Assembly/DOTween/DOTween.cs:1128) DG.Tweening.DOTween.Sequence () (位于D:/DG/_Develop/__UNITY_ASSETS/_Demigiant/__DOTween/_DOTween.Assembly/DOTween/DOTween.cs:732) FadePanel..ctor () (位于 Assets/Assets1/scripts/FadePanel.cs:21)

---------------->

脚本本身:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using DG.Tweening;


public class FadePanel : MonoBehaviour
{
    public CanvasGroup alfaGroup;
    public RectTransform BuyPanel;
    private RectTransform shopButt;
    Vector2 TargetPos;
    Vector2 StartPos;
    Vector2 targBut;

    public List<RectTransform> tranf = new List<RectTransform>();

    private bool isOpen = false;

    Sequence anim = DOTween.Sequence();

    private void Awake()
    {
        TargetPos = BuyPanel.transform.position;
        StartPos = new Vector2(-Screen.width / 2, StartPos.x);

        targBut = new Vector2(90, 177);
    }

    private void OnMouseDown()
    {
        if (!isOpen)
        {
            isOpen = true;

            anim
                .Append(BuyPanel.DOAnchorPos(TargetPos, 1f).From(StartPos))
                .Join(alfaGroup.DOFade(1, 1f).From(0))
                .Join(shopButt.DOAnchorPos(targBut, 1f).From(shopButt.position));

            IconsUp();
        }
        else
        {
            anim
                .Append(alfaGroup.DOFade(0, 1f).From(1))
                .Join(shopButt.DOAnchorPos(shopButt.position, 1f).From(targBut));
        }
    }

    private void IconsUp()
    {
        for (int i = 0; i < tranf.Count; i++)
        {
            anim
                .Append(tranf[i].DOScale(1, 0.5f).From(0));
        }
    }

}
c#
  • 1 个回答
  • 15 Views
Martin Hope
Anick
Asked: 2024-11-24 20:27:36 +0000 UTC

Zenject(Unity)如何传递继承自MonoBehaviour的实体?

  • 6
public sealed class GameInstaller : MonoInstaller
{

    public override void InstallBindings()
    {
        this.Container
            .Bind<Lavash>()
            .FromNew()
            .AsSingle();
     }
}

public class Ingredient : MonoBehaviour 
{
  private Lavash select ;   //этот класс наследуется от MonoBehaviour

   [Inject] 
   public void Construct(Lavash _select) 
   { 
     select = _select;  
   }
}

如果您从“Lavash”类中删除 MonoBehaviour,则一切正常。但我需要它。

如果不去掉,则会出现以下错误:

1)

ZenjectException: Assert hit! Invalid type given during bind command.  Expected type 'Lavash' to NOT derive from UnityEngine.Component 
ModestTree.Assert.That (System.Boolean condition, System.String message, System.Object p1) (at Assets/Plugins/Zenject/Source/Internal/Assert.cs:347) 
Zenject.BindingUtil.AssertIsNotComponent (System.Type type) (at Assets/Plugins/Zenject/Source/Binding/BindingUtil.cs:78) 
Zenject.BindingUtil.AssertTypesAreNotComponents (System.Collections.Generic.IEnumerable`1[T] types) (at Assets/Plugins/Zenject/Source/Binding/BindingUtil.cs:117) 
Zenject.FromBinder.FromNew () (at Assets/Plugins/Zenject/Source/Binding/Binders/FromBinders/FromBinder.cs:63) 
GameInstaller.InstallBindings () (at Assets/Scripts/GameInstaller.cs:12) 
Zenject.Context.InstallInstallers (System.Collections.Generic.List`1[T] normalInstallers, System.Collections.Generic.List`1[T] normalInstallerTypes, System.Collections.Generic.List`1[T] scriptableObjectInstallers, System.Collections.Generic.List`1[T] installers, System.Collections.Generic.List`1[T] installerPrefabs) (at Assets/Plugins/Zenject/Source/Install/Contexts/Context.cs:218) 
Zenject.Context.InstallInstallers () (at Assets/Plugins/Zenject/Source/Install/Contexts/Context.cs:139) 
Zenject.SceneContext.InstallBindings (System.Collections.Generic.List`1[T] injectableMonoBehaviours) (at Assets/Plugins/Zenject/Source/Install/Contexts/SceneContext.cs:346) 
Zenject.SceneContext.Install () (at Assets/Plugins/Zenject/Source/Install/Contexts/SceneContext.cs:265) 
Zenject.SceneContext.Validate () (at Assets/Plugins/Zenject/Source/Install/Contexts/SceneContext.cs:121) 
Zenject.Internal.ZenUnityEditorUtil.ValidateCurrentSceneSetup () (at Assets/Plugins/Zenject/Source/Editor/ZenUnityEditorUtil.cs:67) 
UnityEngine.Debug:LogException(Exception) 
ModestTree.Log:ErrorException(Exception) (at Assets/Plugins/Zenject/Source/Internal/Log.cs:60) 
Zenject.Internal.ZenUnityEditorUtil:ValidateCurrentSceneSetup() (at Assets/Plugins/Zenject/Source/Editor/ZenUnityEditorUtil.cs:72) 
Zenject.Internal.ZenUnityEditorUtil:ValidateAllActiveScenes() (at Assets/Plugins/Zenject/Source/Editor/ZenUnityEditorUtil.cs:96) 
Zenject.Internal.<>c:<ValidateAllActiveScenes>b__16_0() (at Assets/Plugins/Zenject/Source/Editor/ZenMenuItems.cs:262) 
Zenject.Internal.ZenUnityEditorUtil:SaveThenRunPreserveSceneSetup(Action) (at Assets/Plugins/Zenject/Source/Editor/ZenUnityEditorUtil.cs:26) 
Zenject.Internal.ZenMenuItems:ValidateAllActiveScenes() (at Assets/Plugins/Zenject/Source/Editor/ZenMenuItems.cs:260)

ZenjectException: Zenject Validation Failed!  See errors below for details. 
Zenject.Internal.ZenUnityEditorUtil.ValidateCurrentSceneSetup () (at Assets/Plugins/Zenject/Source/Editor/ZenUnityEditorUtil.cs:84) 
Zenject.Internal.ZenUnityEditorUtil.ValidateAllActiveScenes () (at Assets/Plugins/Zenject/Source/Editor/ZenUnityEditorUtil.cs:96) 
Zenject.Internal.ZenMenuItems+<>c.<ValidateAllActiveScenes>b__16_0 () (at Assets/Plugins/Zenject/Source/Editor/ZenMenuItems.cs:262) 
Zenject.Internal.ZenUnityEditorUtil.SaveThenRunPreserveSceneSetup (System.Action action) (at Assets/Plugins/Zenject/Source/Editor/ZenUnityEditorUtil.cs:26) 
UnityEngine.Debug:LogException(Exception) 
ModestTree.Log:ErrorException(Exception) (at Assets/Plugins/Zenject/Source/Internal/Log.cs:60) 
Zenject.Internal.ZenUnityEditorUtil:SaveThenRunPreserveSceneSetup(Action) (at Assets/Plugins/Zenject/Source/Editor/ZenUnityEditorUtil.cs:31)
c#
  • 1 个回答
  • 23 Views
Martin Hope
Anick
Asked: 2024-08-06 18:40:44 +0000 UTC

Vuforia 中的目标数量是否有任何限制 [关闭]

  • 5
关闭。这个问题需要具体说明。目前不接受对此问题的答复。

想要改进这个问题吗? 重新组织问题,使其只关注一个问题。

昨天关门了。

改进问题

我可以在那里扔20000个目标吗?免费或付费计划有任何限制吗?研究数据库并以某种方式实现它有意义吗?

c#
  • 1 个回答
  • 21 Views

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    我看不懂措辞

    • 1 个回答
  • Marko Smith

    请求的模块“del”不提供名为“default”的导出

    • 3 个回答
  • Marko Smith

    "!+tab" 在 HTML 的 vs 代码中不起作用

    • 5 个回答
  • Marko Smith

    我正在尝试解决“猜词”的问题。Python

    • 2 个回答
  • Marko Smith

    可以使用哪些命令将当前指针移动到指定的提交而不更改工作目录中的文件?

    • 1 个回答
  • Marko Smith

    Python解析野莓

    • 1 个回答
  • Marko Smith

    问题:“警告:检查最新版本的 pip 时出错。”

    • 2 个回答
  • Marko Smith

    帮助编写一个用值填充变量的循环。解决这个问题

    • 2 个回答
  • Marko Smith

    尽管依赖数组为空,但在渲染上调用了 2 次 useEffect

    • 2 个回答
  • Marko Smith

    数据不通过 Telegram.WebApp.sendData 发送

    • 1 个回答
  • Martin Hope
    Alexandr_TT 2020年新年大赛! 2020-12-20 18:20:21 +0000 UTC
  • Martin Hope
    Alexandr_TT 圣诞树动画 2020-12-23 00:38:08 +0000 UTC
  • Martin Hope
    Air 究竟是什么标识了网站访问者? 2020-11-03 15:49:20 +0000 UTC
  • Martin Hope
    Qwertiy 号码显示 9223372036854775807 2020-07-11 18:16:49 +0000 UTC
  • Martin Hope
    user216109 如何为黑客设下陷阱,或充分击退攻击? 2020-05-10 02:22:52 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

  • 主页
  • 问题
    • 热门问题
    • 最新问题
  • 标签
  • 帮助

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5