Jump to content

[0.26.1] secure - Entities can only be created in context of a scene


Rinart73

Recommended Posts

Avorion: 0.26.1

Windows 10 x64

 

I get the following error:

Error constructing Entity: Entities can only be created in context of a scene
on line:

local entity = Entity()

 

My code:

local data = {}
--- other code
function Buffs.secure()
    local entity = Entity()
    -- save energy and shield
    data.shield = entity.shieldDurability
    if entity:hasComponent(ComponentType.EnergySystem) then
        data.energy = EnergySystem(entity).energy
    else
        data.energy = nil
    end

    return data
end

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...