error CS0260: Missing partial modifier

C#のpartialを使おうとしてCS0260エラーになる場合は全てのクラスにpartialキーワードが付いているか確認してみてください。

example.cs(0,0): error CS0260: Missing partial modifier on declaration of type 'Example'; another partial declaration of this type exists

エラーになるコード

// Example.cs
public class Example : MonoBehaviour
{
  // 省略
}
// Example2.cs
public partial class Example : MonoBehaviour
{
  // 省略
}

修正したコード

// Example.cs
public partial class Example : MonoBehaviour
{
  // 省略
}
// Example2.cs
public partial class Example : MonoBehaviour
{
  // 省略
}

リンク

Compiler Error CS0260 | Microsoft Docs
https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/cs0260

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です