[英]Set resolution of facebook canvas unity3d
我已经在网络服务器上上传了我的统一游戏,并在Facebook上进行了工作。 但我有Facebook画布分辨率问题。 因为我的游戏是纵向模式。 屏幕分辨率为400 x 600 ..
如何在我的统一项目中设置此分辨率。 由于Facebook设置不允许我设置画布宽度。
我们有可用的方法: FB.Canvas.SetResolution(int width,int height,bool fullscreen,int prefferedRefreshRate,参数Fbscreen.Layout [] layoutparams)
我不知道我应该写哪个Facebook布局参数。
帮帮我..
感谢您的帮助和支持.. :)
好吧,我有一个类似的问题,如果您需要通过Unity的Web Player在Facebook Canvas上设置游戏的分辨率,则只需要:
Application.ExternalCall("IntegratedPluginCanvas.setResolution", width, height);
在Facebook Canvas上以适当的分辨率运行Web Player的游戏有点麻烦,特别是如果您在屏幕上拥有自己注入的HTML。 我发现自己以默认分辨率构建游戏,在Facebook的开发后台上为游戏的配置设置了另一个固定高度,并通过上述方法设置了另一个分辨率。
无论如何,尝试这个:)
我使用下面的代码示例Facebook中的示例给出了解决我的问题:
#region FB.Canvas.SetResolution example
public string Width = "800";
public string Height = "600";
public bool CenterHorizontal = true;
public bool CenterVertical = false;
public string Top = "10";
public string Left = "10";
public void CallCanvasSetResolution()
{
int width;
if (!Int32.TryParse(Width, out width))
{
width = 800;
}
int height;
if (!Int32.TryParse(Height, out height))
{
height = 600;
}
float top;
if (!float.TryParse(Top, out top))
{
top = 0.0f;
}
float left;
if (!float.TryParse(Left, out left))
{
left = 0.0f;
}
if (CenterHorizontal && CenterVertical)
{
FB.Canvas.SetResolution(width, height, false, 0, FBScreen.CenterVertical(), FBScreen.CenterHorizontal());
}
else if (CenterHorizontal)
{
FB.Canvas.SetResolution(width, height, false, 0, FBScreen.Top(top), FBScreen.CenterHorizontal());
}
else if (CenterVertical)
{
FB.Canvas.SetResolution(width, height, false, 0, FBScreen.CenterVertical(), FBScreen.Left(left));
}
else
{
FB.Canvas.SetResolution(width, height, false, 0, FBScreen.Top(top), FBScreen.Left(left));
}
}
#endregion
希望对您有帮助。.谢谢..
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.