设置facebook画布unity3d的分辨率
我已经将我的unity游戏上传到Web服务器上,并将其上传到facebook上。但我有facebook画布分辨率问题。因为我的游戏处于纵向模式。屏幕分辨率为400 x 600 我如何在我的unity项目中设置此决议。因为facebook设置不允许我设置画布宽度 我们有可用的方法: FB.Canvas.SetResolution(int-width、int-height、bool-fullscreen、int-preferredrefreshrate、Params-Fbscreen.Layout[]layoutparams) 我不知道我应该写哪个facebook布局参数 帮帮我,伙计们设置facebook画布unity3d的分辨率,facebook,unity3d,facebook-canvas,facebook-unity-sdk,Facebook,Unity3d,Facebook Canvas,Facebook Unity Sdk,我已经将我的unity游戏上传到Web服务器上,并将其上传到facebook上。但我有facebook画布分辨率问题。因为我的游戏处于纵向模式。屏幕分辨率为400 x 600 我如何在我的unity项目中设置此决议。因为facebook设置不允许我设置画布宽度 我们有可用的方法: FB.Canvas.SetResolution(int-width、int-height、bool-fullscreen、int-preferredrefreshrate、Params-Fbscreen.Layout[
感谢您的帮助和支持……) 我也遇到了类似的问题,如果你需要通过Unity的Web Player在Facebook画布上设置游戏的分辨率,你只需要:
Application.ExternalCall("IntegratedPluginCanvas.setResolution", width, height);
让一个网络玩家的游戏在Facebook画布上以适当的分辨率运行有点混乱,特别是如果你在屏幕上有自己的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
希望这对你们大家都有帮助。。谢谢