Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArgumentNullException & NullReferenceException in GameManager.cs #2

Open
Brainversation opened this issue Mar 20, 2020 · 1 comment

Comments

@Brainversation
Copy link

Hello,

First of all thank you for this project and the video, very helpful for getting into DOTS.

Just a heads up, I am using different versions on Unity (2019.3.2f1) and the other packages (attached image) needed for this project.

Now for the issue:

In GameManager when I call
GameObjectConversionSettings settings = GameObjectConversionSettings.FromWorld( World.DefaultGameObjectInjectionWorld, null ); ballEntityPrefab = GameObjectConversionUtility.ConvertGameObjectHierarchy( ballPrefab, settings );
I get multiple errors on the second line. It seems it has to do with leaving the second argument in the FromWorld function null.

I have attached an image and text of the errors below.

Thanks in advance!

image

image

image

ArgumentNullException: A valid BlobAssetStore must be passed to construct a BlobAssetComputationContext
Parameter name: blobAssetStore
Unity.Entities.BlobAssetComputationContext`2[TS,TB]..ctor (Unity.Entities.BlobAssetStore blobAssetStore, System.Int32 initialCapacity, Unity.Collections.Allocator allocator) (at Library/PackageCache/com.unity.entities@0.8.0-preview.8/Unity.Entities.Hybrid/GameObjectConversion/BlobAssetComputationContext.cs:32)
Unity.Physics.Authoring.BeginColliderConversionSystem.OnUpdate () (at Library/PackageCache/com.unity.physics@0.3.1-preview/Unity.Physics.Hybrid/Conversion/BeginColliderConversionSystem.cs:20)
Unity.Entities.ComponentSystem.Update () (at Library/PackageCache/com.unity.entities@0.8.0-preview.8/Unity.Entities/ComponentSystem.cs:108)
Unity.Entities.ComponentSystemGroup.UpdateAllSystems () (at Library/PackageCache/com.unity.entities@0.8.0-preview.8/Unity.Entities/ComponentSystemGroup.cs:134)
UnityEngine.DebugLogHandler:LogException(Exception, Object)
Unity.Entities.Conversion.JournalingUnityLogger:LogException(Exception, Object) (at Library/PackageCache/com.unity.entities@0.8.0-preview.8/Unity.Entities.Hybrid/GameObjectConversion/JournalingUnityLogger.cs:50)
UnityEngine.Debug:LogException(Exception)
Unity.Debug:LogException(Exception) (at Library/PackageCache/com.unity.entities@0.8.0-preview.8/Unity.Entities/Stubs/Unity/Debug.cs:19)
Unity.Entities.ComponentSystemGroup:UpdateAllSystems() (at Library/PackageCache/com.unity.entities@0.8.0-preview.8/Unity.Entities/ComponentSystemGroup.cs:138)
Unity.Entities.ComponentSystemGroup:OnUpdate() (at Library/PackageCache/com.unity.entities@0.8.0-preview.8/Unity.Entities/ComponentSystemGroup.cs:114)
Unity.Entities.ComponentSystem:Update() (at Library/PackageCache/com.unity.entities@0.8.0-preview.8/Unity.Entities/ComponentSystem.cs:108)
Unity.Entities.GameObjectConversionUtility:Convert(World) (at Library/PackageCache/com.unity.entities@0.8.0-preview.8/Unity.Entities.Hybrid/GameObjectConversion/GameObjectConversionUtility.cs:146)
Unity.Entities.GameObjectConversionUtility:ConvertGameObjectHierarchy(GameObject, GameObjectConversionSettings) (at Library/PackageCache/com.unity.entities@0.8.0-preview.8/Unity.Entities.Hybrid/GameObjectConversion/GameObjectConversionUtility.cs:233)
GameManager:Awake() (at Assets/Scripts/GameManager.cs:41)

NullReferenceException: Object reference not set to an instance of an object
Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle.CheckReadAndThrow (Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle handle) (at <94c5f4c38cdc42d2b006f8badef04394>:0)
Unity.Collections.NativeHashMap2[TKey,TValue].ContainsKey (TKey key) (at Library/PackageCache/com.unity.collections@0.7.0-preview.2/Unity.Collections/NativeHashMap.cs:242) Unity.Entities.BlobAssetComputationContext2[TS,TB].NeedToComputeBlobAsset (Unity.Entities.Hash128 hash) (at Library/PackageCache/com.unity.entities@0.8.0-preview.8/Unity.Entities.Hybrid/GameObjectConversion/BlobAssetComputationContext.cs:97)
Unity.Physics.Authoring.BaseShapeConversionSystem1[T].GetInputDataFromAuthoringComponent (T shape) (at Library/PackageCache/com.unity.physics@0.3.1-preview/Unity.Physics.Hybrid/Conversion/BaseShapeConversionSystem.cs:58) Unity.Physics.Authoring.BaseShapeConversionSystem1[T].OnUpdate () (at Library/PackageCache/com.unity.physics@0.3.1-preview/Unity.Physics.Hybrid/Conversion/BaseShapeConversionSystem.cs:146)
Unity.Entities.ComponentSystem.Update () (at Library/PackageCache/com.unity.entities@0.8.0-preview.8/Unity.Entities/ComponentSystem.cs:108)
Unity.Entities.ComponentSystemGroup.UpdateAllSystems () (at Library/PackageCache/com.unity.entities@0.8.0-preview.8/Unity.Entities/ComponentSystemGroup.cs:134)
UnityEngine.DebugLogHandler:LogException(Exception, Object)
Unity.Entities.Conversion.JournalingUnityLogger:LogException(Exception, Object) (at Library/PackageCache/com.unity.entities@0.8.0-preview.8/Unity.Entities.Hybrid/GameObjectConversion/JournalingUnityLogger.cs:50)
UnityEngine.Debug:LogException(Exception)
Unity.Debug:LogException(Exception) (at Library/PackageCache/com.unity.entities@0.8.0-preview.8/Unity.Entities/Stubs/Unity/Debug.cs:19)
Unity.Entities.ComponentSystemGroup:UpdateAllSystems() (at Library/PackageCache/com.unity.entities@0.8.0-preview.8/Unity.Entities/ComponentSystemGroup.cs:138)
Unity.Entities.ComponentSystemGroup:OnUpdate() (at Library/PackageCache/com.unity.entities@0.8.0-preview.8/Unity.Entities/ComponentSystemGroup.cs:114)
Unity.Entities.ComponentSystem:Update() (at Library/PackageCache/com.unity.entities@0.8.0-preview.8/Unity.Entities/ComponentSystem.cs:108)
Unity.Entities.GameObjectConversionUtility:Convert(World) (at Library/PackageCache/com.unity.entities@0.8.0-preview.8/Unity.Entities.Hybrid/GameObjectConversion/GameObjectConversionUtility.cs:146)
Unity.Entities.GameObjectConversionUtility:ConvertGameObjectHierarchy(GameObject, GameObjectConversionSettings) (at Library/PackageCache/com.unity.entities@0.8.0-preview.8/Unity.Entities.Hybrid/GameObjectConversion/GameObjectConversionUtility.cs:233)
GameManager:Awake() (at Assets/Scripts/GameManager.cs:41)

@celojevic
Copy link

For 2021 users...
Instead of passing null:
GameObjectConversionSettings settings = GameObjectConversionSettings.FromWorld( World.DefaultGameObjectInjectionWorld, null );
You need to pass a new BlobAssetStore() instead.

However, since the blob needs to be disposed, you should cache it in Awake(), then call blob.Dispose() in OnDestroy()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants