Forum rules - please read before posting.

Prefabs for Spine (Multiscript) Player Breaking

edited January 2022 in Technical Q&A

Happy New Year All!

First time posting, so I'd first like to thank you for such a fantastic framework! I've been using it off-and-on for several years now, and AC has only grown more impressive as an adventure game engine while also becoming versatile enough for crossover into other genres.

I'm using: AC 1.73.7, Unity 2019 LTS, multi-skeleton scripts (https://adventure-creator.fandom.com/wiki/Spine_Integration)

Note: I posted a comment in the Fandom post above as well.

Issue: Creating or saving a Prefab using the AnimEngine_Spine script breaks an unknown script reference in the prefab.

My setup works fine prior to creating a prefab:

  • Drag and drop spine exports into project folders
  • Drag and drop SkeletonData asset into hierarchy and create SkeletonAnimation
  • Adventure Creator / Editors / Character wizard (although 1) I have to select one of the other engines at first rather than the custom one or the build breaks and 2) the wizard creates a mesh rather than a sprite)
  • Player setup completion (Sprite child, Spine setup)

https://photos.app.goo.gl/5eF6yTWsnJLk3W6i6

At this point, and before competing the prefab, I can hit play and it works well, navigating and animating with the multiple Spine skeletons as expected.

However, dropping the player into the project folders produces the following error:

Disconnecting is no longer implemented
UnityEditorInternal.InternalEditorUtility:ProjectWindowDrag(HierarchyProperty, Boolean)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Opening the prefab subsequently produces a popup error..

https://photos.app.goo.gl/1o9vSzfS4XDsYhZ98

Console error:
You are trying to replace or create a Prefab from the instance 'Polly New Year' that references a missing script. This is not allowed.
Please change the script or remove it from the GameObject.
UnityEditor.EditorApplication:Internal_CallUpdateFunctions()

The missing script is unknown and does not seem to be a component that is present on the original Player object:

https://photos.app.goo.gl/Ni5W9AcNWBeM97BW9

The Spine Setup has lost its references:

https://photos.app.goo.gl/wbWxaSybsTGMH4C9A

As well as the child sprite:

https://photos.app.goo.gl/EV2sCZhDY2dQUnHG9

I have tried:

  • Re-adding the Spine setup references in the prefab - They just unlink again after saving
  • Replacing the missing script - nothing seems to work here that I've tried (CompletionListener, AnimEngine_Spine)
  • Deleting the component of the missing script - It just reappears
  • Making the child sprite object a prefab and referencing that - Just a wild guess that did nothing
  • Repeating processes in a new project with the AC 2D demo

I have also tried the other script that is available (the single script/skeleton method), but it has its own concerns and makes the handling in Spine very difficult with the high number of bones, images, and animations necessary for a complete player.

If there are alternate viable methods, I'd certainly consider this as well, but given that the setup was working quite well in an isolated scene, and given the Spine build is complete and works very well, It would be a shame to reproduce the work. I have over an hour of gameplay built and am otherwise progressing very well thanks to AC.

Any and all help would be greatly appreciated.

Jacob Falling

Comments

  • Welcome to the community, @JacobFalling.

    I wasn't the author of the original wiki script, but it looks like this could be an issue with the following line inside the first script, AnimEngine_Spine.cs:

    UnityVersionHandler.AddComponentToGameObject <DirectionMapper> (character.gameObject);
    

    This should add a DirectionMapper component to the character's root object, if there isn't one already, but it might be that this is causing issues in the prefab.

    Try removing/commenting out this code, and adding the DirectionMapper component to the character manually, before making your character a prefab.

  • Hello!

    Well, that wasn't a solution exactly, but It did lead me to the solution, which you'll be happy to hear was not only user error (I think) but a very common user error I should have noticed immediately.

    I tried adding the script manually, which failed, and that's when I noticed the error at the top of the editor panel.

    All it was is that the file name and class didn't match (for both DirectionMapper and CompletionListener). I must have named them with the extension included, but didn't notice since it's normal to see those in Windows, etc. In other words, the scripts were "DirectionMapper.cs.cs" and "CompletionListener.cs.cs" in Windows.

    This mismatch only seems to affect it once the prefab is created, so it must be something Unity ignores during play in the editor.

    I'm very grateful for your support, particular on a holiday weekend and given that this is not technically yours to support as AC.

    Thank you, and case closed!

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.