简体   繁体   English

Windows Phone的Unity应用程序崩溃

[英]Unity application for Windows Phone crashes

I have written very simple application in Unity for Windows Phone. 我已经在Unity for Windows Phone中编写了非常简单的应用程序。

Aquarium background, bubbles (particle system) and fishes moving from left to right and right to left. 水族馆背景,气泡(粒子系统)和鱼从左到右,从右到左移动。

I published app to Windows Phone Store for free and in reports there are many crashes. 我免费将应用程序发布到Windows Phone Store,并且在报告中有很多崩溃信息。

Stack trace which can I export: 我可以导出的堆栈跟踪:

App: AquariumInPhone
OS version: 8.0
Problem function: Unknown
Exception type: c0000005
30-day crash count: 23
Stack trace:

Frame    Image          Function                             Offset        
0        ntdll          RtlpWaitOnCriticalSection            0x0000007e    
1        ntdll          RtlpEnterCriticalSectionContended    0x00000060    
2        unityplayer                                         0x002ef5ac

This is very simple application, but crashes :( 这是一个非常简单的应用程序,但是崩溃了:(

Fishes moving left have code: 向左移动的鱼具有代码:

using UnityEngine;

public class Fish1 : MonoBehaviour {

    float speed = 0.0032f;
    Vector3 startPoint;
    Vector3 currentPosition;
    System.Random r = new System.Random ();

    void Start()
    {    
        startPoint = transform.position;
        currentPosition = transform.position;
    }

    void Update ()
    {
        if (Camera.main.WorldToViewportPoint(transform.position).x < -0.2f)
        {
            int newY = r.Next(0, 5);

            if(r.Next(0, 2) == 0)
                newY = -newY;

            Vector3 pos = new Vector3(12.0f, (float)newY, 0.0f);
            currentPosition = pos;
            transform.position = currentPosition;
        }
        else
        {
            currentPosition.x--;
            transform.position += (currentPosition + startPoint) * speed * Time.deltaTime;
        }
    }
}

Fishes moving right have code: 向右移动的鱼具有代码:

using UnityEngine;

public class Fish2 : MonoBehaviour {

float speed = 0.005f;
Vector3 startPoint;
Vector3 currentPosition;
System.Random r = new System.Random ();

void Start()
{    
    startPoint = transform.position;
    currentPosition = transform.position;
}

void Update ()
{
    if (Camera.main.WorldToViewportPoint(transform.position).x > 1.2f)
    {
        int newY = r.Next(0, 5);

        if(r.Next(0, 2) == 0)
            newY = -newY;

        Vector3 pos = new Vector3(-12.0f, (float)newY, 0.0f);
        currentPosition = pos;
        transform.position = currentPosition;
    }
    else
    {
        currentPosition.x++;
        transform.position += (currentPosition + startPoint) * speed * Time.deltaTime;
    }
}
}

What can be the reason of crash? 崩溃的原因可能是什么? How can I fix this? 我怎样才能解决这个问题?

Greets, David 问候,大卫

Because the problem seems to be related to the Unity Engine itself, it would be better to post your problem on the Unity Support Forum . 因为问题似乎与Unity Engine本身有关,所以最好将问题发布到Unity支持论坛上 The devs are watching the forums and are more likely able to help you. 开发人员正在观看论坛,并且更有可能为您提供帮助。

It could be some problematic setting or even a bug in the engine. 这可能是一些有问题的设置,甚至是引擎中的错误。 For example, I had an app for the Windows Store where only one of the scenes would crash. 例如,我有一个Windows应用商店应用程序,其中只有一个场景会崩溃。 In my case the crash only occurred when I used the development build setting and it was crashing before executing my code, so in the end it wasn't a problem with my code. 就我而言,崩溃仅在使用开发构建设置时发生,并且在执行我的代码之前崩溃了,所以最终这不是我的代码有问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM