CesiumGS / cesium-unity

Bringing the 3D geospatial ecosystem to Unity
https://cesium.com/platform/cesium-for-unity/
Apache License 2.0
347 stars 83 forks source link

Game-breaking bug in v1.11.0 #476

Closed electrum-bowie closed 2 months ago

electrum-bowie commented 2 months ago

I'm not at my computer right now, but I'm just making sure that you guys are aware, I don't have the error logs because I instantly downgraded to the previous one and I didn't have time to do anything else that day either way.

The error logs had to do with something related to 'ellipsoid', and each time I tried to write to the 'longitudeLatitudeHeight' property the code failed with that error in the console, completely breaking my project...

electrum-bowie commented 2 months ago

If you aren't aware of this, I'll continue providing info here when I get the chance

j9liu commented 2 months ago

Hey @electrum-bowie, thanks for letting us know. Can you provide step-by-step instructions for reproducing the error? It would help us to have a minimal reproducible example.

electrum-bowie commented 2 months ago

The error logs had to do with something related to 'ellipsoid',

and each time I tried to write to the 'longitudeLatitudeHeight' property the code failed with that error in the console

,completely breaking my project...

azrogers commented 2 months ago

@electrum-bowie Do you mean setting the longitudeLatitudeHeight property on a CesiumGlobeAnchor? I've tried setting this property in the latest version of Cesium for Unity and I'm not able to reproduce this bug. Could you share a sample of the code you were using that was causing this issue?

electrum-bowie commented 2 months ago

Through code, of course setting it through the UI would work

azrogers commented 2 months ago

Setting it through the inspector calls the same method as setting it from code, so I'm not sure it's "of course." 😉 Regardless, I tested with a script. This is the script I used:

using CesiumForUnity;
using System.Collections;
using System.Collections.Generic;
using Unity.Mathematics;
using UnityEngine;

public class Test : MonoBehaviour
{
    // Update is called once per frame
    void Update()
    {
        var anchor = GetComponent<CesiumGlobeAnchor>();
        anchor.longitudeLatitudeHeight = double3.zero;
    }
}

If you run this in your project on Cesium 1.11.0, does this cause an issue?

azrogers commented 2 months ago

@electrum-bowie Are you still experiencing this issue?

electrum-bowie commented 2 months ago

If I go back to the latest version, yes, everything breaks in my project because of this "elipsoid" error.

I unfortunately don't have time to go back and experiment more.. i just wanted to inform you about this extreme bug.

I am forced to stay on an other version for now

electrum-bowie commented 2 months ago

seems like the issue is now gone

electrum-bowie commented 2 months ago

Nope, here it is: image

image

electrum-bowie commented 2 months ago

after running:

    private void LoadSavedVectorLastLocation()
    {
        double x = PlayerPrefs.GetFloat("VectorLastLocationX", 0);
        double y = PlayerPrefs.GetFloat("VectorLastLocationY", 0);
        double z = PlayerPrefs.GetFloat("VectorLastLocationZ", 0);

        if (x != 0 && y != 0 && z != 0)
        {
            cesiumAnchor.longitudeLatitudeHeight = new double3(x, y, z);
        }
    }

at Start();

azrogers commented 2 months ago

I see the issue - if the globe anchor is disabled, _georeference will be null, so that line will fail. I've created a PR for a fix.

electrum-bowie commented 2 months ago

Perfect !

kring commented 2 months ago

Fixed in #480.

electrum-bowie commented 4 weeks ago

Unfortunately that did not fix it, the issue still occurs using the latest cesium unity package version as of today..

electrum-bowie commented 4 weeks ago

I still have to use v1.10 to continue using my existing workflow.

kring commented 3 weeks ago

@electrum-bowie please help us reproduce this issue so that we can fix it. Perhaps you can provide a minimal project that reproduces the issue?

electrum-bowie commented 3 weeks ago

I've worked around it with a hacky solution since that error has indeed been solved.

The solution was to set it consistently until the anchor has been moved.

electrum-bowie commented 3 weeks ago

Really weird, 2 versions ago everything was fine, setting it once did the job