Spawning minicopter with fuel in tank?Solved
I have tried all day trying to accsess the inventory of the minicopter but with no luck, does anyone know if this is even possible and if it is how?
entity.GetComponent<StorageContainer>()
I havve tried that but i can't get it to work.

BaseEntity entity = GameManager.server.CreateEntity(miniCopterPrefab, position + (player.transform.forward * 8));
if (entity != null){
var item = ItemManager.CreateByItemID(-946369541, 1);
item.MoveToContainer(entity.GetComponent<StorageContainer>().inventory);
entity.GetComponent<MiniCopter>().EngineOn();
entity.Spawn();
}​

This is my code and i can't see what i am doing wrong here.
And thanks for the answer. :)

In response to Raldian ():
I havve tried that but i can't get it to work.

BaseEntity entity = GameManager.server.Cr...
var entity = GameManager.server.CreateEntity(miniCopterPrefab, position + (player.transform.forward * 8));
            var copter = entity?.GetComponent<MiniCopter>();
            var container = copter?.fuelStorageInstance.Get(copter.isServer)?.GetComponent<StorageContainer>();
            if (container == null) {return;}
            var item = ItemManager.CreateByItemID(-946369541, 1);
            if (item == null) {return;}
            item.MoveToContainer(container.inventory);
            entity.Spawn();
            copter.EngineOn();

That must be cottect

When using the code you gave it explodes immediately when spawn.

Seems like it can't find the storagecontainer becuase if that is removed it works just fine. :/
In response to Raldian ():
When using the code you gave it explodes immediately when spawn.

Seems like it can't find...
You can check MiniCopter class for extra info
In response to Orange ():
You can check MiniCopter class for extra info
Also try first to spawn Copter and then add ammo
Thank you so much! :D

Making it so the fuel is added after the copter is spawned in did the trick. :D
Locked automatically