Unity-Technologies / 2d-extras

Fun 2D Stuff that we'd like to share!
Other
1.54k stars 342 forks source link

Editor Warning On Creation: No script asset for RuleTile. #351

Closed ShadedLamp closed 1 year ago

ShadedLamp commented 1 year ago

Full warning: No script asset for RuleTile. Check that the definition is in a file of the same name and that it compiles properly.

Renaming the asset breaks the editor with error: "The associated script can not be loaded. Please fix any compile errors and assign a valid script".

There are no errors reported (outside the initial warning about no script asset) in the console.

Manually replacing the script with RuleTile results in an empty inspector and I think completely overwrote the rule tile contents.

To fix the editor, do not replace the script. Instead, reimport the 2D Tilemap Extras folder inside the Unity editor. This will need to be done every time an tile asset is renamed or editor reloaded.

File's m_Script is null'ed out (set to {fileID: 0}) upon reimporting but the asset itself strangely functions perfectly fine in tile palette and painting.

This will result in a constant editor error of "SerializedObjectNotCreatableException: Object at index 0 is null" but the full functionality of tile palette painter and tilemap remain. It is also possible to clear the error so it's easily ignorable.

Unity 2022.2.0 Beta 12.

ChuanXin-Unity commented 1 year ago

Hi, sorry about this! This will be fixed in a future version of the Unity 2022.2 editor!

On Tue, Oct 25, 2022, 11:16 ShadedLamp @.***> wrote:

Full warning: No script asset for RuleTile. Check that the definition is in a file of the same name and that it compiles properly.

Renaming the asset breaks the editor with error: "The associated script can not be loaded. Please fix any compile errors and assign a valid script".

There are no errors reported (outside the initial warning about no script asset) in the console.

Manually replacing the script with RuleTile results in an empty inspector and I think completely overwrote the rule tile contents.

To fix the editor, do not replace the script. Instead, reimport the 2D Tilemap Extras folder inside the Unity editor. This will need to be done every time an tile asset is renamed.

Unity 2022.2.0 Beta 12.

— Reply to this email directly, view it on GitHub https://github.com/Unity-Technologies/2d-extras/issues/351, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHA3TERL47KDYZJOXWJBLJDWE47HFANCNFSM6AAAAAARNQW4FA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

ShadedLamp commented 1 year ago

Amazing to hear. Do you have an ETA on the version that might fix this issue? Is there a way currently using a local version of this package that I can temporarily patch this problem?

ChuanXin-Unity commented 1 year ago

Hi, no ETA for this unfortunately for the beta version. This will be fixed for the released version of 2022.2.

If you are using a local version, could you try moving the class RuleTile at Runtime/Tiles/RuleTile/RuleTile.cs#L15 to a new file instead of keeping RuleTile and RuleTile in the same file?

On Wed, Oct 26, 2022, 00:56 ShadedLamp @.***> wrote:

Amazing to hear. Do you have an ETA on the version that might fix this issue? Is there a way currently using a local version of this package that I can temporarily patch this problem?

— Reply to this email directly, view it on GitHub https://github.com/Unity-Technologies/2d-extras/issues/351#issuecomment-1290788409, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHA3TEQPUKIWUZ3N3QJGRYLWE77LJANCNFSM6AAAAAARNQW4FA . You are receiving this because you commented.Message ID: @.***>

ShadedLamp commented 1 year ago

10/10 solution. Fixed it. Thank you so much. No more reimporting required. Closing ticket.