Forum rules - please read before posting.

Using custom script in object context

Hi,

I have a custom script I am running from an interaction.
I would like to use the context of the gameobject without specifically passing the object through the interaction.
Is this possible?
for example if you write a normal script that inherits from monobehaviour you can simply write transform in the context of the object the component is attached to.

thanks

Comments

  • If the custom script is a MonoBehaviour attached to the Hotspot itself, you can access its gameObject from within. Is your custom script a custom Action, or a regular MonoBehaviour?

  • it is a custom action, using the the action template.

  • edited November 2023

    You can have your custom Action override the AssignParentList function, but bear in mind that it wouldn't be suitable for instances of the Action that are run inside ActionList asset files:

    private Transform ownTransform;
    public override void AssignParentList (ActionList actionList)
    {
        if (actionList)
        {
            ownTransform = actionList.transform;
        }
        base.AssignParentList (actionList);
    }
    
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.