你的浏览器禁用了JavaScript, 请开启后刷新浏览器获得更好的体验!
输入关键字进行搜索
搜索:
发现
话题
· · ·
登录
注册
为什么按钮添加动效后就触发不起了
通过场景触发一个Fui Button通过动效显示出来,可是点击Button没反应,初学者求指导下
没有找到相关结果
已邀请:
与内容相关的链接
提交
1 个回复
木木蒹葭
赞同来自:
public class ButtonBoss : MonoBehaviour
{
private GComponent mainUI;
private GComponent bossCom;
PlayCompleteCallback call;
// Start is called before the first frame update
void Start()
{
mainUI = transform.GetComponent<UIPanel>().ui;
bossCom = UIPackage.CreateObject("Package2","Boss").asCom;
call = callback;
mainUI.GetChild("n1").onClick.Add(()=>{ Click(bossCom); });
}
void Click(GComponent targetCom)
{
mainUI.GetChild("n1").visible = false;
mainUI.GetChild("n2").visible = false;
GRoot.inst.AddChild(targetCom);
Transition t = targetCom.GetTransition("t0");
t.Play(call);
}
void callback()
{
mainUI.GetChild("n1").visible = true;
mainUI.GetChild("n2").visible = true;
GRoot.inst.RemoveChild(bossCom);
}
}
看CallBack方法 再动画播放完字后记得移除你要播放的组件 移除之后点击才有效 就是这句GRoot.inst.RemoveChild(bossCom);
要回复问题请先
登录
或
注册
发起人
j1447720049
相关问题
FairyGUI有考虑过添加类似于panel这样的父容器吗?
一个大按钮中有一个小按钮 如何让两个按钮的点击事件错开
如何实现在播放一个动效的时候停止同一组件的另一个动效
关于添加图集动画的功能
请教下 picovr中射线触发有偏移以及显示上会被大部分UI遮挡的问题
手机滑动触发点击事件,ontouchbegin不对的,例如一排按妞,手指滑动过去后直接触发事件。
在编辑器里测试按钮里的图形颜色没了,unity里也一样
滚动区域超出范围及回弹的时候,滚动条可以添加缩短功能
如何添加自定义属性?
tolua下添加按钮点击事件报错
lua按钮点击事件异常,求大神解救
问题状态
最新活动:
2019-03-27 10:36
浏览:
1538
关注:
2
人
1 个回复
木木蒹葭
赞同来自:
{
private GComponent mainUI;
private GComponent bossCom;
PlayCompleteCallback call;
// Start is called before the first frame update
void Start()
{
mainUI = transform.GetComponent<UIPanel>().ui;
bossCom = UIPackage.CreateObject("Package2","Boss").asCom;
call = callback;
mainUI.GetChild("n1").onClick.Add(()=>{ Click(bossCom); });
}
void Click(GComponent targetCom)
{
mainUI.GetChild("n1").visible = false;
mainUI.GetChild("n2").visible = false;
GRoot.inst.AddChild(targetCom);
Transition t = targetCom.GetTransition("t0");
t.Play(call);
}
void callback()
{
mainUI.GetChild("n1").visible = true;
mainUI.GetChild("n2").visible = true;
GRoot.inst.RemoveChild(bossCom);
}
}
看CallBack方法 再动画播放完字后记得移除你要播放的组件 移除之后点击才有效 就是这句GRoot.inst.RemoveChild(bossCom);