Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

GPU Event not working. Leads to Null Reference Exception

Discussion in 'Graphics Experimental Previews' started by keromonkey, Jun 12, 2019.

  1. keromonkey

    keromonkey

    Joined:
    Jan 16, 2019
    Posts:
    42
    Hello. New to VFX. Initial system works. Secondary system does not.
    Working on spawning child particles using trigger on die > GPU event, etc.

    However, Whenever I connect the 2nd quad output, it stops the entire particle system from working and prints an error in the console.

    This is a single console error, printed repeatedly whenever I make any changes to the particle system while the second quad output is linked up.
    Exception while compiling expression graph: System.NullReferenceException: Object reference not set to an instance of an object
    at UnityEditor.VFX.VFXData.ProcessDependencies () [0x00021] in D:\PROJECTS\GAME Projects\_UNITY ENGINE PROJECTS\PROJECTS\VFX 2019\Library\PackageCache\com.unity.visualeffectgraph@6.7.1-preview\Editor\Data\VFXData.cs:365
    at UnityEditor.VFX.VFXGraphCompiledData.Compile (UnityEditor.VFX.VFXCompilationMode compilationMode, System.Boolean forceShaderValidation) [0x00239] in D:\PROJECTS\GAME Projects\_UNITY ENGINE PROJECTS\PROJECTS\VFX 2019\Library\PackageCache\com.unity.visualeffectgraph@6.7.1-preview\Editor\Compiler\VFXGraphCompiledData.cs:643 : at UnityEditor.VFX.VFXData.ProcessDependencies () [0x00021] in D:\PROJECTS\GAME Projects\_UNITY ENGINE PROJECTS\PROJECTS\VFX 2019\Library\PackageCache\com.unity.visualeffectgraph@6.7.1-preview\Editor\Data\VFXData.cs:365
    at UnityEditor.VFX.VFXGraphCompiledData.Compile (UnityEditor.VFX.VFXCompilationMode compilationMode, System.Boolean forceShaderValidation) [0x00239] in D:\PROJECTS\GAME Projects\_UNITY ENGINE PROJECTS\PROJECTS\VFX 2019\Library\PackageCache\com.unity.visualeffectgraph@6.7.1-preview\Editor\Compiler\VFXGraphCompiledData.cs:643
    UnityEditor.EditorApplication:Internal_CallUpdateFunctions()


    This is the generic setup
    Null Issue.jpg

    What I am trying to figure out is the cause of the error and a fix for it so I can use these GPU events effectively.

    Side-note: Surprisingly, there isn't much on the forums about gpu events or this particular issue. The closest thing is this link, but it doesn't cover or touch my issue.
     
    Last edited: Jun 12, 2019
  2. florianhanke

    florianhanke

    Joined:
    Jun 8, 2018
    Posts:
    426
    I had the same issue - I then connected the GPU Event directly to the Initialize block, which helped.
     
    qsleonard likes this.
  3. keromonkey

    keromonkey

    Joined:
    Jan 16, 2019
    Posts:
    42
    Wow, beautiful advice. Thank you =)
     
    florianhanke likes this.
  4. florianhanke

    florianhanke

    Joined:
    Jun 8, 2018
    Posts:
    426
    Glad it helped! :) (I noticed that the GPUEvent emits a SpawnEvent, which the initialize block also does, so I assumed I do not need it)
     
  5. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    1,236
    Hmm... I am trying to use a "Spawn over Distance" via a GPU Event, which I believe requires being called from the Spawn block. Am I just out of luck for that then?
     
  6. Aaron-Meyers

    Aaron-Meyers

    Joined:
    Dec 8, 2009
    Posts:
    305
    I'm having this same problem. No matter how I try to connect a GPUEvent to a particle system, I get exceptions when it tries to compile.

    HOWEVER, if I change the second particle system to use particle strips, it works fine. But I don't want strips! Is there a bug report for this yet?
     
  7. keromonkey

    keromonkey

    Joined:
    Jan 16, 2019
    Posts:
    42
    gpu event gets directly connected to initialize block
     

    Attached Files:

    • xx.png
      xx.png
      File size:
      41.4 KB
      Views:
      498
  8. Aaron-Meyers

    Aaron-Meyers

    Joined:
    Dec 8, 2009
    Posts:
    305
    Yep... I've connected it directly to the initialize block for both particle and particle strip, only particle strip compiles without exceptions. literally nothing else different.
     
  9. keromonkey

    keromonkey

    Joined:
    Jan 16, 2019
    Posts:
    42
    I do not promise to be an expert, lol. But maybe posting a picture of your set up will provide more insight?
     
  10. Toylips

    Toylips

    Joined:
    Feb 15, 2013
    Posts:
    28
    Why I can't find any GPU Event, and no triggers at all ?... I'm using 2019.4.12f1 lts and Visual Effect Graph 7.3.1
     

    Attached Files:

  11. JJRivers

    JJRivers

    Joined:
    Oct 16, 2018
    Posts:
    137
    Can't recall if it was an experimental block in 7.3.1 but you could try in Unity > Preferences > Visual Effects > [Experimental Operators/Blocks] and then see if you can find it. Since you didn't specify if you're new to it or not i'll give fairly obvious advice that not all blocks be put into all contexts.