Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  3. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Error

Discussion in 'Project Tiny' started by Davit87, Dec 27, 2020.

  1. Davit87

    Davit87

    Joined:
    Mar 18, 2018
    Posts:
    6
    I use this code but it gives an error, what is the problem?

    var screenToWorldSystem = world.GetExistingSystem<ScreenToWorld>();
    var worldPoint = screenToWorldSystem.ScreenSpaceToWorldSpacePos(screenPoint, k_NearClip, ScreenToWorldId.Sprites);


    InvalidOperationException: Assertion failed. Unity.Tiny.Assertions.Assert.IsTrue (System.Boolean condition) (at Library/PackageCache/com.unity.tiny@0.31.0-preview.24/Unity.Tiny.Core/Assert.cs:16)
     
  2. GilCat

    GilCat

    Joined:
    Sep 21, 2013
    Posts:
    676
    Try to use:
    Code (CSharp):
    1. var screenToWorldSystem = world.GetOrCreateSystem<ScreenToWorld>();
    That is a very generic error. But maybe if you follow stacktrace it might help.
     
  3. Davit87

    Davit87

    Joined:
    Mar 18, 2018
    Posts:
    6
    thanks for the answer, but unfortunately it didn't help


    Code (CSharp):
    1. InvalidOperationException: Assertion failed.
    2. Unity.Tiny.Assertions.Assert.IsTrue (System.Boolean condition) (at Library/PackageCache/com.unity.tiny@0.31.0-preview.24/Unity.Tiny.Core/Assert.cs:16)
    3. Unity.Tiny.Rendering.ScreenToWorld.FindPickRoot (Unity.Entities.Entity& eOutPickRoot, Unity.Entities.Entity& eOutPass, Unity.Tiny.Rendering.ScreenToWorldId id) (at Library/PackageCache/com.unity.tiny@0.31.0-preview.24/Unity.Tiny.Rendering/ScreenToWorld.cs:97)
    4. Unity.Tiny.Rendering.ScreenToWorld.ScreenSpaceToWorldSpace (Unity.Mathematics.float2 screenPos, System.Single normalizedZ, Unity.Tiny.Rendering.ScreenToWorldId id) (at Library/PackageCache/com.unity.tiny@0.31.0-preview.24/Unity.Tiny.Rendering/ScreenToWorld.cs:132)
    5. Unity.Tiny.Rendering.ScreenToWorld.ScreenSpaceToWorldSpaceRay (Unity.Mathematics.float2 screenPos, Unity.Mathematics.float3& origin, Unity.Mathematics.float3& direction, Unity.Tiny.Rendering.ScreenToWorldId id) (at Library/PackageCache/com.unity.tiny@0.31.0-preview.24/Unity.Tiny.Rendering/ScreenToWorld.cs:214)
    6. Unity.Tiny.Rendering.ScreenToWorld.ScreenSpaceToWorldSpacePos (Unity.Mathematics.float2 screenPos, System.Single distanceToCamera, Unity.Tiny.Rendering.ScreenToWorldId id) (at Library/PackageCache/com.unity.tiny@0.31.0-preview.24/Unity.Tiny.Rendering/ScreenToWorld.cs:223)
    7. Runtime.CameraUtil.ScreenPointToWorldPoint (Unity.Entities.World world, Unity.Mathematics.float2 screenPoint) (at Assets/Scripts/Runtime/CameraUtil.cs:15)
    8. Runtime.Systems.InputToActionSystem.OnUpdate () (at Assets/Scripts/Runtime/Systems/InputToActionSystem.cs:40)
    9. Unity.Entities.SystemBase.Update () (at Library/PackageCache/com.unity.entities@0.16.0-preview.21/Unity.Entities/SystemBase.cs:413)
    10. Unity.Entities.ComponentSystemGroup.UpdateAllSystems () (at Library/PackageCache/com.unity.entities@0.16.0-preview.21/Unity.Entities/ComponentSystemGroup.cs:435)
    11. UnityEngine.Debug:LogException(Exception)
    12. Unity.Debug:LogException(Exception) (at Library/PackageCache/com.unity.entities@0.16.0-preview.21/Unity.Entities/Stubs/Unity/Debug.cs:19)
    13. Unity.Entities.ComponentSystemGroup:UpdateAllSystems() (at Library/PackageCache/com.unity.entities@0.16.0-preview.21/Unity.Entities/ComponentSystemGroup.cs:440)
    14. Unity.Entities.ComponentSystemGroup:OnUpdate() (at Library/PackageCache/com.unity.entities@0.16.0-preview.21/Unity.Entities/ComponentSystemGroup.cs:387)
    15. Unity.Entities.ComponentSystem:Update() (at Library/PackageCache/com.unity.entities@0.16.0-preview.21/Unity.Entities/ComponentSystem.cs:113)
    16. Unity.Entities.DummyDelegateWrapper:TriggerUpdate() (at Library/PackageCache/com.unity.entities@0.16.0-preview.21/Unity.Entities/ScriptBehaviourUpdateOrder.cs:333)