StageCarema属性问题
问题来源,新人入门学习FGUI的UI适配策略,使用FairyGUI.GRoot.inst.SetContentScaleFactor设置之后,会有留白,为了美观想通过将GRoot.inst.displayObject 做居中偏移来实现;
代码:
float x = (FairyGUI.GRoot.inst.width - AppConst.DesignWidth)/2;
float y = (FairyGUI.GRoot.inst.height - AppConst.DesignHeight)/2;
FairyGUI.GRoot._inst.displayObject.SetXY(x,y);
结果效果是,上下倒是居中了,可以在pad屏上,偏右显示,并未居中。在不明真相的情况下,尝试调整运行中stageCamera的transform,将X调成4,就刚好左右居中。。。
来此想问谷主及其他大佬,1,stageCamera的transform属性的设定依据是什么? 2,这个居中的适配操作正确做法是什么?
新人,轻喷。感谢。
代码:
float x = (FairyGUI.GRoot.inst.width - AppConst.DesignWidth)/2;
float y = (FairyGUI.GRoot.inst.height - AppConst.DesignHeight)/2;
FairyGUI.GRoot._inst.displayObject.SetXY(x,y);
结果效果是,上下倒是居中了,可以在pad屏上,偏右显示,并未居中。在不明真相的情况下,尝试调整运行中stageCamera的transform,将X调成4,就刚好左右居中。。。
来此想问谷主及其他大佬,1,stageCamera的transform属性的设定依据是什么? 2,这个居中的适配操作正确做法是什么?
新人,轻喷。感谢。
没有找到相关结果
已邀请:
4 个回复
ikobe
赞同来自:
ikobe
赞同来自:
谷主
赞同来自:
ikobe
赞同来自: