Forum rules - please read before posting.

Game Object ID in Action List not taken into account

Hi,

I'm trying to create a custom action which will display a close up on an object.
I want to display a background sprite (the same for all close-ups) and the sprite of the actual close-up of the object. I'm working in 2D and I want to create a custom action list for that.

this is my custom action (show_close_up):
(the 0 action adds the background sprite)
image

so I'm running this custom action from another action and pass an ID of a prefab as a parameter. the constant ID is set on the prefab:
image

and this is the action calling the "show_close_up":
image

when I run this, nothing happens, the prefab is not added to the scene.
If a change the show_close_up action, and insted of the parameter put the prefab itself it works perfectly fine.
so I guess the problem is with passing the game object IP as a parameter and not with this suit of actions.

could someone please help me sort this out?  ;)
thanks 

Comments

  • Welcome to the forum, @axoona.

    The problem is that the ID number is used to refer to objects within a scene - not to find prefabs within your Asset folder.

    Currently, you have to use an ActionList: Run Action within the scene itself (not as an asset file) to be able to assign the GameObject parameter with a GameObject - otherwise you do it with an ID number.  However, this brings up a good point about its usage - I will see if it is possible to assign a GameObject field directly when using an asset also in an update.
  • Thank's for your comment, adding the objects to the scene resolved the problem.

    Although, I've added them out of site of the main camera, it clutters a bit the scene and the hierarchy. Especially that for close-ups on inventory objects, I guess you need to add the "close-up" of the inventory object on every scene?
    My project is not very big so it's not a problem but I think that for larger games it would be great to be able to assign a prefab directly! :)
    Thank's for taking it into account.

    I have another question otherwise. When I want to make a close-up on an object in inventory, I'm calling a dedicated action list each time, which then calls the custom action list with the close-up object to show as a parameter.
    Is there a better way to do it? 
    Like for examle calling the custom function directly for each inventory object and pass the object and its "close-up view" for example as a parameter?
  • The first issue has since been addressed in v1.53c.

    The second question: that's the correct way to do it unless you want to dive into custom scripting.  AC provides events that can be hooked into (see tutorial here), which you can insert your own code and functionality into.

    One of these events is named Call_OnUseInventory, and is invoked when an item is clicked interacted with.  If you wanted to reduce your interactions down to one ActionList, you could use this event to set the value(s) of the ActionList's parameters directly through script.
  • Thank's for this rapid update of this issue! :)

    I will definitely look into invocation with scripts, thank's for the tip.
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.