reckfellENGINE

RF0108: Inspector button needs a Tool class

ExportToolButton is used in a class that does not run editor code.

On this page

For a C# project using Reckfell.NET.Sdk 1.0.0. Fix the first build error first: later messages may be a consequence.

Cause

ExportToolButton is used in a class that does not run editor code.

Fix

Add Tool when the action should run in the editor; otherwise remove ExportToolButton. Guard destructive actions in your own code.

Failing example

Save the file in a test C# project and run dotnet build. This version intentionally fails to build.

Example.cs
C#
using Reckfell;

namespace DiagnosticExamples.RF0108;

public partial class Example : Entity
{
    public int Count { get; private set; } = 7;
    [ExportToolButton("Reset")] public Callable ResetButton => Callable.From(Reset);
    private void Reset() => Count = 0;
}

Expected messages: RF0108.

Working version

Replace the failing version with these files; do not keep both declarations in the project.

Example.cs
C#
using Reckfell;

namespace DiagnosticExamples.RF0108;

[Tool]
public partial class Example : Entity
{
    public int Count { get; private set; } = 7;
    [ExportToolButton("Reset")] public Callable ResetButton => Callable.From(Reset);
    private void Reset() => Count = 0;
}

Result

ResetButton.Call() changes Count from 7 to 0. Tool allows this class to execute in the editor.

All C# diagnostics · C# guide

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.