tested in Window 7, unity 2017.3
If project contain a ScriptableObject class like this:
using UnityEngine;
[Game]
public class Configs : ScriptableObject
{
public GameObject gameObject;
}
below error will appear after execute Jenny gen
Sequence contains no elements
and generator won't work
why are you need to do this ???
@chiuan you can make global setting on Unity's inspector. This important to Game designer
What do you think about:
[Game]
public class ConfigsComponent : IComponent
{
public Configs value;
}
public Configs : ScriptableObject {
<....>
}
public class LoadConfigsInitializeSystem : IInitializeSystem {
private readonly Configs configs;
private readonly GameContext context;
public LoadConfigsInitializeSystem(GameContext context, Configs configs) {
this.configs = configs;
this.context = context;
}
public void Initialize() {
context.CreateEntity().AddConfigs(configs);
}
}
Just write a simple InitializeSystem to set your Component.
This thing actually worked back in the day, we used to store settings components like that. Just mark a custom Settings : ScriptableObject class with [Game] and it should generate an appropriate component:
SettingsComponent : IComponent
{
Settings value;
}
So I guess it's an issue with the new generator?
It took some time to separate Component and ScriptableObject, but it looks cleaner now so I have no complaint. Entitas' Attribute above non-IComponent looks confusing.
Can reproduce, works with the default code generator, doesn't work with roslyn. Will investigate...
As a workaround please manually create the ConfigsComponent
[Game]
public sealed class ConfigsComponent : Entitas.IComponent {
public Configs value;
}
Ok, fixed. Will be in next release.
In case anyone is interested: Explanation:
The fix for #532 introduced that behaviour because all inherited members where inspected too to support subclassed components. The same functionality was applied for non-components. I fixed this to not inspect sublasses of non-components.
Fixed in Entitas 0.47.9
Most helpful comment
Fixed in Entitas 0.47.9