Dynamically displaying depthkit clips at runtime in Unity

Hi there! I have a prefab in Unity with DepthKit clips, and I want to dynamically load in + instantiate that prefab within a scene at runtime. When I drag my prefab directly into a scene from editor - not at runtime - there are no issues. If the prefab is in the scene at the moment of pressing ‘play’, and is active and enabled, there are also no issues.

However, when I dynamically load in the DepthKit prefab at runtime - the gameobject, when instantiated, is set as the child of a parent holder that is disabled/turned off by default (as intended).

When I then enable/turn on that parent, my DepthKit clips have quite a lot of null parameter errors and the DepthKit clips are not visible - it’s hard to pinpoint the cause (or what the parameter ‘t’ is).

If anyone has any insight that would be much appreciated! I need to know how much of the issue is caused by addressables vs. being caused by the gameobject being disabled.

ArgumentNullException: Value cannot be null.
Parameter name: t
Depthkit.CoreVFXLook.SetLookProperties () (at Depthkit_Studio_Expansion_Package/depthkit.core.vfx/Runtime/CoreVFXLook.cs:87)
Depthkit.Look.OnUpdate () (at Depthkit_Studio_Expansion_Package/depthkit.core/Runtime/Looks/Look.cs:94)
Depthkit.Look.LateUpdate () (at Depthkit_Studio_Expansion_Package/depthkit.core/Runtime/Looks/Look.cs:230)

Unity version: 2021.3.16f1

Hi @VickyPotts

First, so sorry not responding to this sooner. We aim to be much more responsive on support forums, and this fell through the cracks!

Because your use pattern is a bit unique, we have not had time to attempt to reproduce this specific issue on our side.

A few quick notes:

  • You are using Unity 2021, and we test and verify against Unity 2020.3 LTS. I recommend quickly trying and verifying if the issue persists in 2020.3 LTS as well.
  • The issue seems to be something with the VFX graph based on the stack trace. If you remove the VFX graph renderer and just use the Core renderer, does the issue persist? Is there perhaps a reference to a VFX Look that is still enabled on a different component?
  • You may try to disable the VFX components specifically, not only the parent game object.

Let me know if any of this is helpful in diagnosing the issue.

Hi, @VickyPotts. We think we have identified the cause of this issue, and it should be fixed in the upcoming version of our Unity plugins. We’ll let you know when it’s available.

@VickyPotts - following up to ensure you saw that, alongside Depthkit v0.7.0, we also released Phase 9 of the Depthkit Expansion Packages for Unity, which includes the fix we believe applies to your issue. Update the packages in your project and let us know if your issue is addressed.