Forum rules - please read before posting.

[SOLVED] Object transform not allowed for prefab object -what to do instead?

edited April 2014 in Technical Q&A
Hello fellow AC toddlers,
I would like my character to throw an inventory item to a certain spot. I think I have it all correctly set up, but when I run the game and initiate the interaction that triggers the throwing, I get the following error:

Setting the parent of a transform which resides in a prefab is disabled to prevent data corruption.
UnityEngine.Transform:set_parent(Transform)
AnimEngine_Legacy:ActionCharHoldRun(ActionCharHold) (at Assets/AdventureCreator/Scripts/Animation/AnimEngine_Legacy.cs:341)
ActionCharHold:Run() (at Assets/AdventureCreator/Scripts/Actions/ActionCharHold.cs:78)
AC.<RunAction>c__Iterator1:MoveNext() (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:140)
UnityEngine.MonoBehaviour:StartCoroutine(String, Object)
AC.ActionList:ProcessAction(Int32) (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:126)
AC.ActionList:BeginActionList(Int32) (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:104)
AC.ActionList:Interact() (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:70)
AC.<UseObject>c__Iterator3:MoveNext() (at Assets/AdventureCreator/Scripts/Controls/PlayerInteraction.cs:770)

I have configured four actions:
- Character:Hold Object
- Object:Visibility
- Engine:Pause (2s)
- Object:Transform

The error message is quite clear and must originate from the first action. Unfortunately that doesn't help me to figure out what to do instead.

What can I do to be able to throw that object?

Thanks for any pointers ...
orrence.

Comments

  • I've had problems like this too- the best solution I can come up with is to actually create the gameobject in the scene, and have your actions refer to that scene object rather than the prefab. 

    A possible alternative that I haven't tried is by using the new feature which can store a constant ID in the prefab object. You can then have your scene action refer to an inventory/menu actionlist with the engine: run actionlist action, where that inv/menu actionlist refers to the constant ID of the prefab object. 

    I've had problems with that new system (a torch that changes it's constant ID every now and then) so I recommend the first solution, but feel free to try either. Or let me know if you find a better solution!
  • Don't reference the prefab.  Skitt's got the right suggestion with the ConstantID number.

    @skitt2501: ConstantID numbers should NEVER reset!  Please let me know how/why it changed if you can.  Be aware that as of 1.29 you can set a number manually, but I'd hope you shouldn't have to.
  • Oh really? I had an issue where the player would be holding a torch with a remember transform and visibility script through multiple scenes while the torch is only a scene object in the first scene. When moving to the second scene the player would still be holding it, but then when I go back to the first scene the torch would get a new constant ID. 

    I'm not exactly sure what caused the problem, as I've since completely changed it so that each scene has its own torch scene object so that this issue doesn't happen... But if I had to guess, I would say there is an issue with having the torch being moved through multiple scenes versus the torch scene object in the first scene.
  • Yes, that sounds about right - I was going to suggest doing what you've done had you not already.
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.