Forum rules - please read before posting.

Play animation of crafting

edited August 2019 in Technical Q&A

Sorry for all my questions...

So i have 2 pieces of a key that you can find in the game and the n you can combine those to create a key.
i want an animation of when the two pieces combines into a key to play when combining them.

Right now i put the animation in the player prefab so that it should animate over the player wherever he stands in the scene.

But i dont have an player in all of my scenes so this wont work. i also tryed to parent it with the camera but then it wont work across scenes. I want the player to be able to combine them in any of my scenes.

heres an video example of how i kinda want it to look. just an animation centered in the scene.


referens video (Pettson och Findus) should be copied just before the reward animation plays.

The name of the items are (trasig is broken in swedish) "trasiggrej" "trasigsak" "specialkey/specialnyckel"

https://imgur.com/pVZ50eq
player prefab

https://imgur.com/JiV2XOa
specialkey animator

https://imgur.com/6zhEot0
actionlisteditor

https://imgur.com/V0iELMR
the two items in inventory

https://imgur.com/1xxzukF
specialkey

https://imgur.com/qViln65
trasiggrej inspector

https://imgur.com/sE5XA3b
trasig sak inspector

https://imgur.com/tz9VWqy
specialnyckel inspector

https://imgur.com/ZogtYSX
recipe

Malte

Comments

  • Bear in mind that when AC talks about "crafting", it's referring to use of a special Crafting interface where multiple inventory items can be combined into 1, Minecraft-style.

    To just combine two items together, you don't need to use the Crafting / Recipe system. Simply defining a "Combine interaction" in the item's properties is enough.

    When you use an asset-based Action to control an object in the scene, it'll automatically create and assign a Constant ID number (see "36746" in this image). This is how ActionList assets "find" objects in the scene again after reloading.

    Create a new GameObject in the scene for the key animation, and attach the same Animator / Sprite Renderer as your "specialkeyanimation", and remove the old one from your Player prefab.

    Then attach a Constant ID component, change its Set field to Manual and enter in the same number (36746) as that recorded by the ActionList asset. When the ActionList runs, it'll link to this object instead and play the animation - so long as this object is in the scene.

    To make this work in any scene, check Retain in prefab? and make the GameObject a prefab. You can then drop it into all your scenes, and the ID number will be the same - so that the ActionList asset will always find it.

    For more on this topic, see these tutorials: (1) (2)

  • Now the animation plays when it should in all the scenes where i add the prefab to.

    How can i make so that the specialkey animation is always centered in the camera view? if possible...
    i switch between different cameras, but the best would be if i could combine the items and play the animation whatewer view im currently in.

    Big thank you for the answers.

  • There's a few ways:

    1. Just parent the animated GameObject to the MainCamera, so that it always appears in the same place on-screen
    2. Attach a script that centres it's position on-screen every frame - this isn't AC-specific but you should be able to find such a script or similar topic on the Unity forums
    3. I don't know how complex the animation is, but if it's just changing colours / size or something you could make it the child of a Unity UI Canvas, which has its own controls for always appearing in the same place on-screen. Again, this doesn't involve AC, but you could have a play around with Unity UI in a non-AC scene to test with.
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.