Forum rules - please read before posting.

Custom Action failing in Build

Hi

I have a basic custom action that disables a sprite renderer. It works fine in Play mode in the editor but when the game is built (either WebGL or Windows) the custom action doesn't run.

The in game editor shows "Object reference not set to an instance of an object"

But really I can't see why as the object involved has a sprite renderer attached to it, and works perfectly when played in the editor. Any ideas?

https://drive.google.com/file/d/1-KaXm1PqHRr16tHdqsvcqw_-OXa2CcTl/view?usp=sharing, https://drive.google.com/file/d/1-RIvDGazB584wfWpRIU0i96ZjdOxvF8c/view?usp=sharing, https://drive.google.com/file/d/1-RWNUe2PUZvCnFEvGGYzNynl3neoPV6w/view?usp=sharing

Olly

Comments

  • edited May 2023

    If your custom Action makes use of the Constant ID and/or Parameter systems, you'll need to have those integer variables update the GameObject within an override of Action's AssignValues function:

    public override void AssignValues (List<ActionParameter> parameters)
    {
        spriteRendererToAffect = AssignFile <GameObject> (parameters, parameterID, constantID, spriteRendererToAffect);
    }
    
  • Thanks Chris. I did have that but it wasn't on the screenshot. Oddly, Visual Studio wasn't complaining about the "AssignFile " bit but when I removed the "" part everythign worked normally and the game worked in a build as expected.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.