awake/start方法执行多次的问题
unity3d吧
全部回复
仅看楼主
level 6
a5417201 楼主
代码
private void Awake()
{
//offSet = forOffSet.position.x - drawCard.position.x;
//ownCard = this.GetComponent<UISprite>();
//frame = this.transform.Find("cardFarmel").GetComponent<UISprite>();
Debug.Log(1);
}
执行结果
上面的代码其实就一个debug其他的基本上都注释了,但依然有6个1 按照道理将 awake只会执行一次 为什么会有6个1 我人已经晕了 有没有大神解答下[阴险]
2019年03月11日 15点03分 1
level 6
a5417201 楼主
然后看了看其他的脚本 加上这个一共4个awake 是4个1 我都死心了 为什么是6个[惊哭]
2019年03月11日 15点03分 2
level 11
你看看有没有没找到的,搜索下试试,今天
2019年03月11日 16点03分 3
level 8
debug改一下就知道了,Debug.Log(name)
2019年03月11日 17点03分 4
level 7
Debug.log("输出内容",gameobject);
2019年03月12日 03点03分 6
level 1
楼主怎么解决的,我遇到会执行两次
2022年03月11日 09点03分 7
参考楼上,点击会定位的
2022年03月11日 10点03分
level 4
继承(继承了monobehaviour的类)挂载在gameobject上会运行父类的awake方法
2023年07月16日 15点07分 8
level 1
我遇到一个因为runInEditMode=true导致start执行两次的情况,是AnimationClipSettings的问题,虽然无关,但记录一下排查了很久的问题
2024年04月18日 09点04分 9
level 5
执行多次很可能是脚本挂载出问题了
2024年04月19日 04点04分 10
1