我开始使用unity 3d for android探索游戏开发.我已经下载了unity 3.3的试用版.我经历了一些教程.
我有一个问题没有回答.在我们使用eclipse开发的普通应用程序中,我们可以通过复制apk文件部署到移动设备上.团结3d怎么样?如何将游戏放到手机上.我不想在市场上发布.
我想根据玩家使用kinect和Unity的动作来移动头像,有没有好的教程?
我们使用unity和Kinect接口来创建一个简单的应用程序.根据玩家的动作,我们需要移动头像.
我们都应该使用Unity有GAKUNITY,无OpenNI或任何第三方工具.
有什么好的教程GakUnity with Kinect吗?
GAK 手段 Gadget Accelerator Kit
我们只想avatar在kinect界面前移动任何玩家移动.即使帮助在手运动也高度赞赏.
您还可以分享有关统一和kinect编程的有用链接或书籍.
编辑:所以在与Assimp dev进行短暂接触之后,我被指向了导入过程.当我从其他人手中接过代码时,我没想到要看那个部分:
using (var importer = new AssimpContext())
{
scene = importer.ImportFile(file, PostProcessSteps.Triangulate | PostProcessSteps.FlipUVs | PostProcessSteps.JoinIdenticalVertices);
}
Run Code Online (Sandbox Code Playgroud)
FlipUV完全按照它所说的做法,它在y轴上翻转,因此原点现在位于左上角.所以现在我能够获得具有适当UV但仍然是镜像网格的模型.使用比例x = -1设置父对象会将其翻转回正常并使其看起来很好,但我想这并不意味着.所以我一直在寻找.
看图,有两种起重机型号.左边的那个在运行时通过序列化和重建加载,而右边的那个是原始的,只是拖动到场景.序列化发生在Assimp库中.
地板碰巧首先被创建,似乎得到了正确的紫外线地图.而其他项目出错了uv map.虽然我正在打印紫外线地图的值,但它们似乎与原始地图相匹配.
这是序列化的方法,这是来自Assimp的Mesh类,而不是Unity Mesh类,应用程序序列化是在UWP中构建的Windows应用程序:
private static void SerializeMeshes(BinaryWriter writer, IEnumerable<Mesh> meshes)
{
foreach (Mesh mesh in meshes)
{
ICollection<int> triangles = MeshLoadTriangles(mesh);
MeshSerializeHeader(writer, mesh.Name, mesh.VertexCount, triangles.Count, mesh.MaterialIndex);
MeshSerializeVertices(writer, mesh.Vertices);
MeshSerializeUVCoordinate(writer, mesh.TextureCoordinateChannels);
MeshSerializeTriangleIndices(writer, triangles);
}
}
private static void MeshSerializeUVCoordinate(BinaryWriter writer, List<Vector3D>[] textureCoordinateChannels)
{
// get first channel and serialize to writer. Discard z channel
// This is Vector3D …Run Code Online (Sandbox Code Playgroud) 如何使用Unity在C#中发送HTTP GET和POST请求?
我想要的是:
我尝试过的:
大多数问题都是使用线程,我在C#中没有足够的经验.我使用的文本编辑器是Intellij Rider.
我正在尝试使用IronPython作为Unity3D的外部脚本语言.IronPython执行所需的DLL在Assets\Plugins内部加载得很好.但是,当我尝试运行脚本时,我收到此错误:
PythonImportErrorException: No module named UnityEngine
IronPython.Modules.Builtin.__import__ (IronPython.Runtime.Calls.ICallerContext,string,object,object,object) <IL 0x0003b, 0x001cc>
(wrapper dynamic-method) object.__import__##5 (IronPython.Runtime.Calls.ICallerContext,object,object,object,object) <IL 0x0000e, 0x0004d>
IronPython.Runtime.Calls.FastCallableWithContextAny.Call (IronPython.Runtime.Calls.ICallerContext,object,object,object,object) <IL 0x00015, 0x00067>
IronPython.Runtime.Calls.BuiltinFunction.Call (IronPython.Runtime.Calls.ICallerContext,object,object,object,object) <IL 0x0000d, 0x00058>
IronPython.Runtime.Operations.Ops.CallWithContext (IronPython.Runtime.Calls.ICallerContext,object,object,object,object,object) <IL 0x00012, 0x000b0>
IronPython.Runtime.Importer.Import (IronPython.Runtime.PythonModule,string,IronPython.Runtime.List) <IL 0x0000d, 0x0006c>
IronPython.Runtime.Operations.Ops.Import (IronPython.Runtime.PythonModule,string) <IL 0x00007, 0x0003b>
(wrapper dynamic-method) object.<string>##1 (IronPython.Runtime.ModuleScope) <IL 0x0006b, 0x00210>
Run Code Online (Sandbox Code Playgroud)
脚本和'UnityEngine.dll'位于同一文件夹中.这是脚本:
import clr
clr.LoadAssemblyFromFile("UnityEngine.dll")
import UnityEngine
from UnityEngine import *
Debug.Log("Hello World from Python!")
Run Code Online (Sandbox Code Playgroud) 我想了解如何编写线程安全代码.
例如,我在我的游戏中有这个代码:
bool _done = false;
Thread _thread;
// main game update loop
Update()
{
// if computation done handle it then start again
if(_done)
{
// .. handle it ...
_done = false;
_thread = new Thread(Work);
_thread.Start();
}
}
void Work()
{
// ... massive computation
_done = true;
}
Run Code Online (Sandbox Code Playgroud)
如果我理解正确,可能会发生主游戏线程和我_thread可以拥有自己的缓存版本_done,并且一个线程可能永远不会_done在另一个线程中看到更改?
如果可能,如何解决?
是否可以解决,只应用volatile关键字.
或者是有可能读取和写入,通过价值Interlocked的类似的方法Exchange和Read?
如果我包围_done读写操作lock (_someObject),需要我使用Interlocked什么东西来防止缓存?
编辑1
关于协同程序(在Unity3D和其他地方)如何工作,我感到困惑和好奇.coroutine是新线程吗?他们说Unity的文档:
协程是一个可以暂停执行(yield)直到给定的YieldInstruction完成的函数.
他们在这里有C#示例:
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
void Start() {
print("Starting " + Time.time);
StartCoroutine(WaitAndPrint(2.0F));
print("Before WaitAndPrint Finishes " + Time.time);
}
IEnumerator WaitAndPrint(float waitTime) {
yield return new WaitForSeconds(waitTime);
print("WaitAndPrint " + Time.time);
}
}
Run Code Online (Sandbox Code Playgroud)
我对这个例子有很多疑问:
在上面的例子中,哪一行是协程?是WaitAndPrint()一个协程?是WaitForSeconds()一个协程?
在这一行:yield return new WaitForSeconds(waitTime);为什么都yield和return存在?我在Unity文档中读到"yield语句是一种特殊的返回,它确保函数将在下次调用yield语句后继续执行." 如果yield是特别的return,return这里做了什么?
为什么我们要退货IEnumerator?
是否StartCoroutine开始新线程?
WaitAndPrint() …
如何在TextUI.text = ....睡眠功能之间放置,每个短语之间等待3秒?
public Text GuessUI;
public Text TextUI;
[...truncated...]
TextUI.text = "Welcome to Number Wizard!";
TextUI.text = ("The highest number you can pick is " + max);
TextUI.text = ("The lowest number you can pick is " + min);
Run Code Online (Sandbox Code Playgroud)
我已经尝试了各种各样的东西,但没有奏效,这样:
TextUI.text = "Welcome to Number Wizard!";
yield WaitForSeconds (3);
TextUI.text = ("The highest number you can pick is " + max);
yield WaitForSeconds (3);
TextUI.text = ("The lowest number you can pick is " + min);
Run Code Online (Sandbox Code Playgroud)
在bash中将是: …
我正在创建一个实现Soomla Unity IAP插件的应用程序.为了让IAP工作,我已经达到了可以在编辑器中进行购买的程度.(不是真正的购买,它只是更新用户可以在游戏中购买/消费的虚拟货币).
当我在Android设备上启动它时,我收到此错误:需要身份验证.您需要登录自己的Google帐户.
现在我已经阅读了多篇不同的文章,其中人们已经遇到过这个问题,似乎没有什么能帮助我.
这是我到目前为止所尝试的列表:
1)确保应用程序发布到alpha或beta进行测试.(现在在alpha中)
2)确保价格与游戏和开发者控制台相匹配.
3)使用以未使用开发人员电子邮件的用户身份登录的设备.
4)确保测试设备上的电子邮件在开发人员控制台中列为测试人员.
5)确保Android Manifest中列出了必要的权限.
6)确认商家帐户已正确设置并验证.
7)确保构建为发布而不是开发(不确定这是否重要,但我尝试了两种方式).
8)从项目中完全删除了所有Soomla插件,然后将其添加回来,同时非常仔细地遵循教程,以确保没有错过任何小的.仍然没有骰子.
我将核心和商店组件添加到他们必要的场景中.如果您对解决此问题应采取的措施有任何其他想法,请告诉我.同时,这是我用于设置Soomla的StoreAssets.cs代码:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using Soomla.Store;
public class StoreAssets : IStoreAssets
{
public static bool purchased = false;
public int GetVersion()
{
return 0;
}
public void onItemPurchased(PurchasableVirtualItem pvi, string payload)
{
purchased = true;
}
public VirtualCurrency[] GetCurrencies()
{
return new VirtualCurrency[]{TOKEN_CURRENCY};
}
public VirtualGood[] GetGoods()
{
return new VirtualGood[] {BACKUP_FORCEFIELD, IMMUNITY, EMP, MULTIPLIER};
}
public VirtualCurrencyPack[] GetCurrencyPacks()
{
return …Run Code Online (Sandbox Code Playgroud) 我希望在Android手机上运行时从Unity Application获取日志.为此,我必须从Unity3D导出Android项目并使用Android Studio运行它.我正在做以下步骤:
我在Gradle控制台中遇到以下错误:
FAILURE:构建因异常而失败.
出了什么问题:任务执行失败':'ModuleName':transformClassesWithDexForDebug'.java.lang.UnsupportedClassVersionError:com/android/dx/command/Main:java.lang.ClassLoader.defineClass(ClassLoader.java:800)at java.lang.ClassLoader.defineClass1(Native Method)中不支持的major.minor版本52.0 at java.net下的java.net.URLClassLoader.access $ 100(URLClassLoader.java:71)的java.net.URLClassLoader.defineClass(URLClassLoader.java:449)中的java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142). URLClassLoader $ 1.run(URLClassLoader.java:361)java.net.URLClassLoader $ 1.run(URLClassLoader.java:355)java.security.AccessController.doPrivileged(Native Method)at java.net.URLClassLoader.findClass(URLClassLoader.) java:354)at java.lang.ClassLoader.loadClass(ClassLoader.java:425)at sun.misc.Launcher $ AppClassLoader.loadClass(Launcher.java:308)at java.lang.ClassLoader.loadClass(ClassLoader.java:358 )在sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)线程"main"中的异常
com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:进程'命令'C:\ Program Files\Java\jdk1.7.0_79\bin\java.exe''以非完成零退出值1
尝试:使用--stacktrace选项运行以获取堆栈跟踪.使用--info或--debug选项运行以获取更多日志输出.
建筑失败
总时间:0.788秒
java.lang.UnsupportedClassVersionError:com/android/dx/command/Main:java.lang.ClassLoader.defineClass(ClassLoader.java:800)at java.lang.ClassLoader.defineClass1(Native Method)中不支持的major.minor版本52.0 at java.net下的java.net.URLClassLoader.access $ 100(URLClassLoader.java:71)的java.net.URLClassLoader.defineClass(URLClassLoader.java:449)中的java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142). URLClassLoader $ 1.run(URLClassLoader.java:361)java.net.URLClassLoader $ 1.run(URLClassLoader.java:355)java.security.AccessController.doPrivileged(Native Method)at java.net.URLClassLoader.findClass(URLClassLoader.) java:354)at java.lang.ClassLoader.loadClass(ClassLoader.java:425)at sun.misc.Launcher $ AppClassLoader.loadClass(Launcher.java:308)at java.lang.ClassLoader.loadClass(ClassLoader.java:358 )在sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)线程"main"中的异常
我很久以前就一直在使用Eclipse,但之前从未遇到过这种情况.任何人都可以指导我如何在Android Studio中成功运行Unity-Android项目吗?