Forum rules - please read before posting.

Can you help me with my EnableCandle action?

I have a script made for me called ACSpineExpressions, attached to the maincamera, and if using an Object Call Event, you can call a spine animation for the character to hold candle anim, however I need to call this from an action list not in the scene also, which means this method won't work, also I am finding that the call event won't happen in OnStart and needs to actually be forced once scene has loaded.

Are you able to take a look and maybe help me turn this into a custom action instead? Would really appreciate your help on this! The enable / disable candle action would be better placed in it's own script, and also in an ideal world be customisable so I can enter 'enablexxxxx / disablexxxxx' depending on the animation.

See screenshot and video below, I have popped the script in there too:

https://www.dropbox.com/sh/70ucl0b53f5kham/AABYHUnIJlamk90dLCxJjs2Ga?dl=0

Comments

  • As the script relies on events, it would not be suitable for a custom Action.

    The Object: Call event Action cannot be used to reference a scene object from an asset, but the Object: Send message Action can.

  • edited July 2023
    And would the message be the same? EnableCandle? Plus would send message happen instantly on scene load? As call event is not
  • Yes - the message would be the name of the function.

  • edited July 2023
    Ok that doesn’t seem to work. I think I’ll have to find another solution. Not sure if this is an issue?

    NullReferenceException: Object reference not set to an instance of an object
    ACSpineExpressions.EnableCandle () (at Assets/Scripts/ACSpineExpressions.cs:71)
    UnityEngine.Events.InvokableCall.Invoke () (at /Users/bokken/build/output/unity/unity/Runtime/Export/UnityEvent/UnityEvent.cs:178)

    But ultimately, I need it to not have to be forced and run scene start when called in scene, which it doesn't and two the send message doesn't work outside of scene - tried EnableCandle and EnableCandle ()
  • The error is coming from the script - AC is calling the function correctly, but the component it's calling doesn't have its skinSetter variable assigned at the time.

  • edited July 2023
    Would you know how to make this event taken immediately on load of scene? As you can see from the video link above I have to re run the code or move the player to make the candle appear and and the spine candle anim work?

    Plus, is there a way to adapt this script so it doesn’t rely on events and can therefore be used as a custom action?

    Thanks
  • You can have the script run code when the scene begins within its Start function, but if you want to ensure that AC is initialised first, hook into the OnAfterChangeScene event.

    The script itself couldn't be adapted into an Action - it's purpose is to update itself at given times, rather than be called manually. It's not involving AC, however.

  • ok thanks, any idea why the object send message is not working? I tried EnableCandle as custom

  • Let's see screenshots.

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.