Forums › 💬 NodeCanvas › ⚙️ Support › null-ref in Cutscene.OnValidate under certain circumstances
Under certain circumstances, we’ll get a null-ref exception in the Validate() method on Cutscene.cs
I noticed this when using Unity’s QuickSearch.
It will use LoadAssetAtPath so it can ask Unity for a thumbnail for the given asset.
Unity will fire the OnValidate which will cause the exception.
For the time being, I just added a if (group == null) { continue; }
like this public void Validate() {
if ( groupsRoot.transform.parent != this.transform ) { groupsRoot.transform.parent = this.transform; }
directables = new List(); foreach ( IDirectable group in groups.AsEnumerable().Reverse() ) { if (group == null) { continue; }
Seems to have worked.
I’m not sure why it would be null, but I confirmed by attaching a debugger and it was indeed null.
I’m reporting here because this might be part of something bigger.
I’m on the latest SLATE (1.9.4) and Unity 2019.3.0b4.
Hey,
Please post Slate things in the Slate forums! 🙂 With that said, what exactly is the exception line thrown?
Thanks.
Oh man, I can’t believe I messed up the forums.
Sorry!
>With that said, what exactly is the exception line thrown?
It’s just a normal null-ref because group will be null.
The exception itself will be triggered in this line (group is null)
foreach ( IDirectable track in group.children.Reverse() ) {
Should I open a thread on the SLATE forums instead of continuing this one?
Hi,
Sorry for the late reply. I was able to reproduce this issue and is now fixed for the next version. Don’t worry about messing the forums 🙂
Thank you!