OnCopyComponent has been removed in the recent versions?

Issue #38 resolved
Damian Abalo created an issue

Hello. I just udpdated uPrefabs to the last available version, and all my component processors crash now with the following message:

Assets/AntiheroStudios/uPrefabs/Editor/Processors/ColumnProcessor.cs(9,30): error CS0115: `AntiheroStudios.uPrefabs.Editor.ColumnProcessor.OnCopyComponent(UnityEngine.GameObject, UnityEngine.Component, UnityEngine.GameObject, UnityEngine.Component)' is marked as an override but no suitable method found to override

It seems that the OnCopyComponent does not work anymore. Looking in the documentation I couldn't find anything on this regard. What is going on?

Comments (4)

  1. Devon Klompmaker

    Damian,

    My apologies for breaking your code with the refactoring. There are now two methods OnApplyComponent and OnRevertComponent that can be used.

    By default each of those methods calls into OnCopyObject which provides the base functionality.

    Creating ComponentProcessors is only necessary if the default behaviour doesn't work as expected or you want to customize for a special case.

    I'm interested to know which components, or changes, you made processors for so I can capture the use case in future versions.

    Let me know if you need anything else!

  2. Devon Klompmaker

    As a follow up: If you simply want to refactor your OnCopyComponent to OnRevertComponent, that will resolve your issue and behave as it had before the refactoring.

    Thanks,

  3. Damian Abalo reporter

    Hello Devon. I just refactored my processors tu use OnRevertComponent instead of OnCopyComponent. They are compiling and working again, but you should update this documentation, since it is no longer valid: https://bitbucket.org/antiherostudios/uprefabs/wiki/Component%20Processors

    My use case is simple. I want some public variables to be affected by the revert, but others I want to keep. As an example, if my prefab is a column, I want to keep the length, as this will vary per instance of the prefab, but If I change the tiles themselves, I want this change to affect all columns. This is why I use processors, and I thought it was the intended use honestly.

  4. Log in to comment