问题标签 [unity-web-player]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
160 浏览

unity3d - Unity3D网络播放器的摄像头控制

是否可以在 Web 播放器上播放的 Unity3D 项目中控制相机?

我想在网络播放器中使用 JavaScript 控制现有模型的遍历。

我看到他们有用于调用脚本中定义的内部函数的 API 函数,但看不到任何访问相机的方法。

0 投票
0 回答
98 浏览

facebook - Facebook Unity Webplayer

I have some problems with my game. It works fine in any browsers directly: https://unnyhog.com/public/upload/web_unny2/web_unny2.html

But when I'm trying to launch it as facebook app, I get a problem : https://apps.facebook.com/unnyworld_test/

It works fine only on my computer and only in Firefox. Everywhere else nothing happens, even unity web player didn't start at all. Just blank white page or webplayer progress bar with 0%.

These are my canvas settings:

Did anyone have such problems?

0 投票
1 回答
536 浏览

c# - Unity NullReference 尝试使用 ParseFacebookUtils 登录解析时

我不熟悉 SO 用户标签,所以我希望这可行:@aaron

这是我能找到的与我的问题最接近的问题,但这并不是问题所在。(我尝试了 Google、Bing 和 SO 自己的搜索。) https://stackoverflow.com/questions/25014006/nullreferenceexception-with-parseobjects-in-array-of-pointers

我的问题:我有一个与 Facebook 和 Parse 交互的 Unity Web-Player 游戏。在解决了其中的许多问题后,我将它轻松连接到 Facebook,提取用户的个人资料信息和图片。然后它尝试连接到 parse 以将用户登录到 parse 以检索他们的游戏相关数据(如高分、货币统计、电源等),当它尝试这样做时,我得到一个 NullReferenceException。报错信息的具体内容为:

“NullReferenceException:对象引用未设置为 GameStateController.ParseFBConnect (System.String userId, System.String accessToken, DateTime tokenExpiration) [0x0001a] 在 C:...\Assets\Scripts\CSharp\CharacterScripts\GameStateController 中的对象实例.cs:1581 at GameStateController.Update () [0x0011f] 在 C:\Users\Michieal\Desktop\Dragon Rush Game\Assets\Scripts\CSharp\CharacterScripts\GameStateController.cs:382"

生成此错误消息的代码是:

它正在按该顺序传递正确的(经过身份验证的)Facebook 值(FB.UserId、FB.AccessToken、FB.AccessTokenExpiresAt)。我正在使用 FB Sdk 6.0.0 版和 Parse Unity SDK 1.2.16 版。

在日志文件中,它没有任何 debug.log/Util.log 注释,而是执行“空引用”错误(上图),然后是“关于解析 url:https ://api.parse.com/1 /classes/_User

检查是否https://api.parse.com/1/classes/_User是否为有效域

针对有效域检查请求主机:api.parse.com:*"

这就是它刚刚停止的地方。因此,我在 Update() 函数中构建了一个简单的重试块,以每隔 10 秒左右调用一次 ParseFBConnect() 函数。其中,似乎只会用相同的错误集填充我的日志文件。在互联网上搜索帮助后,我尝试将 FB.AccessTokenExpiresAt 更改为 DateTime.UtcNow.AddDays(1),因为其他人说这对他们有用。我似乎无法为我工作。当我在 Parse 中检查仪表板以查看它是否显示任何更新或活动时,它没有,而且现在已经有几天没有了。脚本执行顺序如下:

Parse.ParseInitialzeBehaviour -- -2875(第一件事)Facebook 加载程序(FB、编辑器、画布等) -- -1000 到 -900 GameStateController -- -875 ... 所以,我知道 Parse.ParseInitializeBehaviour 正在加载首先(另一个搜索结果),我通过更改登录方法的存储位置将 NullReference 跟踪到 Parse.Unity.dll;GSC 在播放器上(播放器从初始屏幕开始并在整个游戏中保持不变)。我还尝试将 Parse.ParseInitializeBehaviour 放在 Player 游戏对象和一个空的游戏对象上(上面有一个简单的 dontdestroy(gameObject) 脚本)。而且,我在对象上正确填写了我的应用程序 ID 和我的 DotNet 密钥。

当我第一次设置解析时,在游戏的当前生产版本上,它可以根据上面的代码片段成功创建一个用户帐户。现在,它只是在尝试解析 url 时中断......

所以,我的问题是:我做错了什么?还有其他人有这个问题吗?有没有人有任何想法/建议/等等,如何解决这个问题?我真的只是想让它工作,并让用户登录,这样我就可以获取他们的数据并继续在我的游戏中破坏其他东西:D

感谢所有帮助!感谢您抽出宝贵时间阅读本文。

0 投票
0 回答
347 浏览

c# - 在 Unity WebPlayer 中等待输入

我正在构建一个嵌入在 Windows 窗体应用程序中的 Unity3d 可视化系统。我可以来回进行 WebPlayer 和 C# 通信。

WebPlayer 需要能够根据用户的输入绘制任意数量的模型(例如,绘制 30 个足球然后对其进行操作)。当对象的数量被硬编码时,我可以绘制对象并很好地操纵它们,但是在场景中绘制任何东西之前如何获取用户输入呢?

目前我有一个附加到主摄像头的脚本,它对我提示输入的 javascript 函数进行外部调用,检查输入是否大于 0 并在摄像头脚本的 Update() 中启动创建。

在统一编辑器中,当我按下播放时,直到我修改公共变量然后模型按预期创建,但在 WebPlayer 中它只是继续在场景中绘制其他东西,就好像条件不存在并且没有模型一样由于整数仍为 0,因此绘制。

请帮助我了解如何实现这一目标。谢谢

在主相机脚本中:

在网络播放器的 javascript 中:

最后在创建附加到中心点的对象的脚本中:

0 投票
1 回答
2390 浏览

unity3d - unity webplayer 游戏如何添加 Adsense?

我想知道我怎样才能在统一游戏中添加 Google Adsense 仅用于网络播放器。我知道我们使用移动设备 admob 。

我在 kongregate.com 和其他几个网站上看到了游戏,他们有几秒钟的计时器,而这次他们在游戏 iframe 中展示了他们的谷歌广告。

现在我怎么能在团结中做同样的事情?

0 投票
1 回答
172 浏览

facebook-unity-sdk - Facebook SDK and WebPlayer. Init will not callback

Trying to let the Facebook SDK working with the WebPlayer. I have a problem with the init function: it's not calling the success callback and no exceptions are happening.

I want to explain what I'm trying to do. I have a standalone WebPlayer app loaded on my server (it's not a Facebook canvas). I would like to be able to login with Facebook to authenticate the user and show him/her customized stats (the name, the picture, etc...). No interactions required I would just use Facebook for the authentication.

Anyone any idea why this is not working?

Cheers

0 投票
2 回答
475 浏览

graphics - Webplayer GUI 渲染问题像素化

我用unity3d制作了一个游戏,它的图形在unity引擎中看起来很完美。但是当我构建它并在网络播放器中播放时,它的图形变得像素化和模糊。
那么我怎样才能让它成为网络播放器的像素完美游戏呢?

0 投票
2 回答
1930 浏览

c# - (Unity Web)如何在浏览器检查器中显示 Debug.Log 而不是“~/Library/Logs/Unity”?

我想知道如何在浏览器检查器中显示 Debug.Log 而不是“~/Library/Logs/Unity”。由于我在开发多人游戏,现在打开两个浏览器,日志显示在同一个日志文件中,一团糟!

顺便说一句,我看到构建设置中有一个选项“脚本调试”,但没有运气。

0 投票
2 回答
771 浏览

unity3d - ParseFacebookUtils.LogInAsync gives an error on WebPlayer only

I am using the Parse Unity SDK along with the Facebook Unity SDK in my game so users can log in with their Facebook account.

It's working well on mobiles (Android and iOS), and in the editor.

In Facebook Canvas (WebPlayer), on my machine (Mac Mini), with my main session (Administrator), with every browsers (Chrome, Safari, Firefox), I get an error upon calling this code :

#xA;

The output is as follows :

#xA;

This error doesn't appear on other sessions on my machine, and it doesn't appear on my teammates' machines either.

Here is what I tried so far (not necessarily in that order) :

  • Cleared browsers caches
  • Tried in private navigation mode
  • Going to unity3d.com/webplayer/setup to delete all cached files
  • Going to unity3d.com/webplayer/setup to disable caching of files
  • Uninstalling and fresh install of the Unity Web Player (downloaded from Chrome)
  • Uninstalling and fresh install of the Unity Web Player (downloaded from Firefox)
  • Deleted all WebPlayerPrefs on my machine
  • Changed permissions of PlayerPrefs folder and files to rw for everyone
  • Uninstalling Unity Web Player, Copy of the Unity Web Player files from the mac where the error doesn't appear to install manually
  • Including PlayerPrefs.DeleteAll()` in my code before LogInAsync

Additionaly, there are numerous times where the game doesn't even load (blank canvas instead of Game Logo + loading bar). Blank web player also happens sometimes when going to unity3d.com/webplayer/setup.

I am fairly certain that the problem comes either from a permission conflict, or a cache I don't know of.

Any idea what I can try now ?

0 投票
0 回答
471 浏览

build - Unity Webplayer——构建和发布

我通过点击构建了我的游戏File → Build settings → Web Player → Build

然后,我将构建游戏的文件夹复制到我的 Dropbox 文件夹中(即,我将我的HTML和我的UNITY3D文件都上传到了我的 Dropbox 文件夹中)。

在我刚刚复制的文件夹(现在在我的 Dropbox 中的那个)中,我右键单击生成的HTML文件并单击Share Dropbox link.

我将链接提供给人们,但是当他们将链接复制并粘贴到URL浏览器中并授予插件运行权限时,什么也没有发生...

我在某个地方错过了一步吗?

谢谢,