Fix CS1061: 'BaseEntity' does not contain a definition (Oxide)
CS1061 means you called a member on a variable whose compile-time type does not declare it. In Rust plugins the usual cause is holding a BaseEntity, BaseNetworkable or other base type when the member lives on a derived class such as BaseCombatEntity, so you need an explicit cast before using it.
Error while compiling EntityHealthCheck: [1] 'BaseNetworkable' does not contain a definition for 'Health' and no accessible extension method 'Health' accepting a first argument of type 'BaseNetworkable' could be found (are you missing a using directive or an assembly reference?) at 35:66
Why it happens
The Rust assembly has a deep type hierarchy: BaseNetworkable is the root, BaseEntity derives from it, BaseCombatEntity derives from BaseEntity, and BasePlayer, BaseAnimalNPC, BuildingBlock and StorageContainer derive from BaseCombatEntity. Members like Health(), MaxHealth(), Heal(), Hurt() and health are declared on BaseCombatEntity, not on BaseEntity. When your variable is typed as BaseEntity (for example a method parameter, or the result of an enumeration over BaseNetworkable.serverEntities cast to the wrong type), the compiler only sees the members declared on that exact type or its bases, so Health() is an unknown symbol.
The same error appears when Facepunch renames or removes a member in a Rust update, or when you use a type name from another namespace and expect a method that the type never had (for example calling IsOpen() on a BaseEntity instead of a Door).
How to fix it
- Look at the column and line in the compiler message and identify the variable the member was called on.
- Check where the member is actually declared: Rust API pages and the assembly browser show the declaring type (Health() is on BaseCombatEntity; inventory and SendNetworkUpdate are on other levels).
- Change the variable's type or add an explicit cast, e.g.
var entity = ... as BaseCombatEntity;and null-check it before use. Preferasover a direct cast when the object may be a plain BaseEntity. - If the member no longer exists in the current Rust build, replace it with the new name (or with
health/MaxHealth()). - Save the file; Oxide recompiles automatically. A clean compile prints
Loaded plugin ...with noError while compilingline. You can also runoxide.reload EntityHealthCheck.
Before and after
using System.Collections.Generic;
using Oxide.Core;
using UnityEngine;
namespace Oxide.Plugins
{
[Info("Entity Health Check", "RustPluginGenerator", "1.0.0")]
[Description("Reports the health of entities in a radius around the player")]
public class EntityHealthCheck : RustPlugin
{
private const float Radius = 5f;
[ChatCommand("checkhealth")]
private void CmdCheckHealth(BasePlayer player, string command, string[] args)
{
if (player == null)
{
return;
}
var found = new List<string>();
foreach (var entity in BaseNetworkable.serverEntities)
{
if (entity == null || entity.IsDestroyed)
{
continue;
}
if (Vector3.Distance(entity.transform.position, player.transform.position) > Radius)
{
continue;
}
// CS1061: Health() is declared on BaseCombatEntity, not BaseNetworkable
found.Add(entity.ShortPrefabName + ": " + entity.Health());
}
if (found.Count == 0)
{
SendReply(player, "No entities within " + Radius + "m");
return;
}
SendReply(player, string.Join("\n", found.ToArray()));
}
}
}using System.Linq;
using System.Collections.Generic;
using Oxide.Core;
using UnityEngine;
namespace Oxide.Plugins
{
[Info("Entity Health Check", "RustPluginGenerator", "1.0.0")]
[Description("Reports the health of entities in a radius around the player")]
public class EntityHealthCheck : RustPlugin
{
private const float Radius = 5f;
[ChatCommand("checkhealth")]
private void CmdCheckHealth(BasePlayer player, string command, string[] args)
{
if (player == null)
{
return;
}
var found = new List<string>();
foreach (var networkable in BaseNetworkable.serverEntities)
{
var entity = networkable as BaseCombatEntity;
if (entity == null || entity.IsDestroyed)
{
continue;
}
if (Vector3.Distance(entity.transform.position, player.transform.position) > Radius)
{
continue;
}
found.Add(entity.ShortPrefabName + ": " + entity.Health());
}
if (found.Count == 0)
{
SendReply(player, "No entities within " + Radius + "m");
return;
}
SendReply(player, string.Join("\n", found.ToArray()));
}
}
}FAQ
Why does the error mention BaseEntity when my object is a player?
Because the variable or parameter is declared as BaseEntity, even though the runtime object is a BasePlayer. The compiler only sees the declared type. Cast to BasePlayer or BaseCombatEntity first, then call Health() or MaxHealth().
What is CS1061 different from CS0117?
CS1061 is about calling a member (method or property) that the type does not declare. CS0117 fires when the member you reference does not exist on the type at all in a static context. The fix is usually the same: find the declaring type or rename the member.
The plugin worked last month and now fails with CS1061. Why?
A Rust update can rename or move a member. Oxide recompiles every plugin when the server restarts, so a removed method shows up as CS1061 on the line that used it. Check the current Rust assembly or the console line number and update the call.
Can I keep a variable as BaseEntity and still call Health()?
No. C# resolves members at compile time from the declared type. You must cast to BaseCombatEntity (or use as plus a null check) so the compiler knows the member exists. Store the casted reference if you call it repeatedly.
Different error?
Paste the full console output and get the cause and a fix in plain English.
Open the error explainerSkip the debugging
Generated plugins are compiled before you get them, and compiler errors are fixed automatically.
Generate a plugin2 free plugins a month, no card.
Last updated Oct 26, 2026.
Get plugins that compile first time
Generate