Hi, i tried to add some existing facepunch components (e.g BasePet, Frankenstein -Brain or -Pet, MiniCopter in another case) to entities (e.g manually spawned BasePlayer) but always get NullReferenceException in different variations - it flooding in console or just not work.
I have searched how to do that in plugin sources but found only adding selfwritted components
Is it even possibly? Maybe i am doing it completly wrong?
That code flooding NullReference warnings in console
private void Spawn(BasePlayer owner, Vector3 position)
{
var entity = GameManager.CreateEntity("assets/prefabs/player/player.prefab", position);
var pet = entity.gameObject.AddComponent<FrankensteinPet>(); // also tried entity.GetOrAddComponent<FrankensteinPet>();
entity.Spawn();
pet.Brain.SetOwningPlayer(owner);
}