unity3d

How can I place Unity WebGL in my React Native app?

醉酒当歌 提交于 2021-02-07 04:55:10
问题 I have written a simple React Native app using WebGL. I used https://github.com/JilvanPinheiro/reactive-native-unity-webgl import Unity from 'react-native-unity-webgl'; ... render() { return ( <Unity width="500px" height="350px" onProgress={ this.onProgress } src="http://192.168.1.101/Build/Ultimatum.json" loader="http://192.168.1.101/Build/UnityLoader.js" />` ); } But I'm getting the error below: ReferenceError: Can't find variable: document. This error is located at: in Unity (at App.js:9)

Unable to change FOV of the google card board camera

感情迁移 提交于 2021-02-07 03:38:29
问题 I am developing a sniper game for android using Google card board unity SDK. Now there is the need to tweak the camera's FOV which leads me to interact a variable named 'mockFieldOfView' in CardBoard.cs. Tweaking that value in the Unity editor is fine but as soon as I make a build for Android it doesn't take effect at all. I'm unable to figure out the issue. Any idea or suggestion would be highly appreciated. Apologize for the late reply, so ouflak you can see complete Cardboard.cs here

Unable to change FOV of the google card board camera

跟風遠走 提交于 2021-02-07 03:35:42
问题 I am developing a sniper game for android using Google card board unity SDK. Now there is the need to tweak the camera's FOV which leads me to interact a variable named 'mockFieldOfView' in CardBoard.cs. Tweaking that value in the Unity editor is fine but as soon as I make a build for Android it doesn't take effect at all. I'm unable to figure out the issue. Any idea or suggestion would be highly appreciated. Apologize for the late reply, so ouflak you can see complete Cardboard.cs here

Dealing with autocad objects in Unity

99封情书 提交于 2021-02-06 20:45:31
问题 I am new in Unity development and I have good experience in Autocad development. Is it possible to use 3d solids & 3d mesh terrains created in autocad and display it in the Unity interface and also get its properties (such as 3D solid color, dimensions, handles etc..) 回答1: Unity supports .FBX, .dae (Collada), .3DS, .dxf and .obj files. If your Autocad can export to any of these then the answer is yes . It is possible but read below. Objects produced in Autocad, SolidWorks or other similar

Why doesn't a struct in an array have to be initialized?

一曲冷凌霜 提交于 2021-02-06 15:21:56
问题 I researched this subject but I couldn't find any duplicate. I am wondering why you can use a struct in an array without creating an instance of it. For example, I have a class and a struct : public class ClassAPI { public Mesh mesh { get; set; } } public struct StructAPI { public Mesh mesh { get; set; } } When ClassAPI is used in an array, it has to be initialized with the new keyword before being able to use its properties and methods: ClassAPI[] cAPI = new ClassAPI[1]; cAPI[0] = new

Hololens TCP Sockets - Python Client to Hololens Server

冷暖自知 提交于 2021-02-06 12:53:45
问题 After a couple weeks of frustration I was finally able to send a string from a Python client to a Hololens server. The code is below and runs perfectly. However, I was wondering if someone experienced with sockets could help me modify this code to send an openCV webcam frame (so basically just send an image) from Python to the Hololens. I've been trying but the image data does not seem to be received in the C# script. Thank you so much. Hololens Server Code: using System; using System

How to import 3D scene (.obj file with .mtl file)

岁酱吖の 提交于 2021-02-06 11:24:39
问题 I bought a 3D Model of a room. The model is in the .obj format. Now, I'm trying to import this model into Unity3D. The Model came with: 5 x .obj files 5 x .mtl files n x .jpg files n x .tga files The .mtl files contained paths that do not exist on my PC. So I removed the paths. The images files ( .jpg & .mtl ) are in the same directory as the .obj files. When I tried to import the .obj files, the room has no material on it. I then tried to use the FBX converter (with "Embed media" checked) to

C#代码优化:拯救你的CPU耗时

扶醉桌前 提交于 2021-02-06 10:28:40
之前,我们已经对 本地资源检测 中和 资源/Prefab的内容做了总结 ,后续UWA也会和大家一起努力,进一步丰富这些检测内容。今天我们要聚焦的是本地资源检测中的C#代码相关的检测项。 要保证游戏在流畅的帧率下运行,就要保证CPU和GPU能够及时地完成它们在一帧当中的“任务”。而本文我们讲解的这些C#代码的性能,就会影响到每帧CPU自身的耗时。当游戏出现帧率降低、间歇性卡顿甚至卡死等现象时, 我们就需要考虑这是否是由开发者自己所编写的脚本性能较差所造成的。 性能的优化问题,实际上是个“时空问题”:我们要尽可能地节省运算所需的时间,节约内存上占用的空间。对C#代码的优化亦是如此,一方面是对CPU耗时的优化,一方面是对内存分配的优化。而“空间问题”与“时间问题”又常常会相互转化——优化内存的目的之一,是减少GC,这又可以归结为减少CPU耗时。本文要讲解的一系列规则,就是主要针对CPU耗时的规则。 1、类中存在OnGUI方法 规则里涉及到的OnGUI,它是Unity的IMGUI系统绘制UI所调用的方法。该方法如果写在继承了Monobehavior的脚本上,那么Unity会在每一帧自动对其进行调用。 使用IMGUI进行UI绘制,想要更改任何内容,整个图形用户界面都要重新绘制,OnGUI会在一帧当中调用多次,这会导致CPU耗时增加。此外,如果OnGUI函数使用不当,容易造成堆内存的持续分配

C#代码优化:斩断伸向堆内存的“黑手”

断了今生、忘了曾经 提交于 2021-02-06 10:28:27
在上期 《C#代码优化:拯救你的CPU耗时》 中,我们依托 UWA本地资源检测 ,从“时间”的角度对C#代码检测中和CPU耗时相关的知识点为大家进行了简单的讲解。本篇将从“空间”角度入手,为大家继续梳理C#代码检测的相关规则。 C#是在虚拟机(VM)环境当中运行的(Mono虚拟机或IL2CPP虚拟机),其分配的堆内存是由虚拟机进行管理与回收的,因此,C#代码被称为“托管代码”,其堆内存又被称为“托管内存”。托管内存的释放依赖于虚拟机的GC(垃圾回收)机制,本文就不展开讨论了。 C#程序开发要遵循的一个基本原则就是避免不必要的堆内存分配,而堆内存分配主要会造成以下后果: 程序所占用的内存总量过大。内存是有限的资源,对于游戏(特别是移动游戏)来说,内存的占用可谓是寸土寸金。过多的无法释放的内存很可能导致程序崩溃的现象。 过多的分配次数会导致堆碎片变多,从而可能导致无法开辟出所需要的连续的内存,这也会导致程序崩溃。 内存分配会触发GC(垃圾回收),而GC的代价较高,会造成卡顿。 1、该类的方法中存在 .tag的调用 tag是场景中GameObject的标签,而类GameObject的成员tag是一个属性,在获取该属性时,实质上是调用get_tag()函数,从native层返回一个字符串。字符串属于引用类型,这个字符串的返回,会造成堆内存的分配。然而

swipe gestures on android in unity

青春壹個敷衍的年華 提交于 2021-02-06 09:28:06
问题 I'm trying to get unity to recognize that I am swiping left to right, I have solved that but my issue is that it doesn't understand this till I lift my finger off the screen. My question is how would i make it so that it knows i went right and then left and then right again all without ever taking my finger of the screen Here is the code I have so far using UnityEngine; using System.Collections; public class Gestures : MonoBehaviour { private Vector2 fingerStart; private Vector2 fingerEnd;