Phase I laid the groundwork for creating, saving, loading and modifying blueprints (introduced in 0.30.2).
Phase II focuses on updating and repairing blueprints, e.g when a component got renamed or fields got renamed or removed.
Blueprints are considered as external configuration and they eventually have to be migrated every time you change your code.
If you already tested Blueprints Beta you can drop your feedback here. Does it work? Any pain points? Bugs?
It would be nice to have event firing when Blueprint inspector is updated in playmode, that would give a possibility to test blueprints live.
@grygus on my list now :) thanks
It's all bugs I found at the moment.
Blueprints are very cool :)
Found another little bug.
When BinaryBlueprint selected in Project tab, right after compilation:
NullReferenceException: Object reference not set to an instance of an object
Entitas.Unity.VisualDebugging.EntityDrawer.DrawComponents (Entitas.Pool pool, Entitas.Entity entity) (at Assets/Libraries/Entitas/Unity/VisualDebugging/Entity/Editor/EntityDrawer.cs:91)
Entitas.Unity.Serialization.Blueprints.BinaryBlueprintInspector.OnInspectorGUI () (at Assets/Libraries/Entitas/Unity/Serialization/Blueprints/Editor/BinaryBlueprintInspector.cs:145)
And from my previous post - bug 3 was my bug. Looks like you fixed it in 30.2, and I did not get fix because I create pools manually, without generator.
It seems that it only generates one blueprints class. I was hoping it would generate one blueprints class for each blueprints.asset file.
So I tried something like that in a component for blueprints.
using Entitas;
using System;
[Meta]
public class CharactersComponent : IComponent
{
public Character[] chars;
}
[Serializable]
public class Phrases
{
public string greetings;
public string grief;
public string happy;
}
[Serializable]
public class Character
{
public string name;
public int age;
public Phrases phrases;
}
And thought of using it as a some kind of scriptableObject alternative, but I guess this functionality is not there yet. :)
http://goo.gl/QKLZGl
And after Add element. BOOM!
http://goo.gl/Jkk4X9
Overall Blueprints are great! It's a very nice idea and it fits very well into Entitas.
However here are some features that would make them even better.
Here's a bit of my code with blueprints at the moment:
var tubeSegmentBlueprints = _pools.pool.blueprints.instance.blueprints
.Select(b => b.Deserialize())
.Where(b => b.components.Any(c => c.index == ComponentIds.TubeSegment))
.ToArray();
var currentEnvironmentTubeSegmentBlueprints = tubeSegmentBlueprints
.Where(b => (EnvironmentType)b.components.First(c => c.index == ComponentIds.StartEnvironment).members.First().value == startEnvironment
&& (EnvironmentType)b.components.First(c => c.index == ComponentIds.EndEnvironment).members.First().value == endEnvironment)
.ToArray();
var tubeSegmentBlueprint = currentEnvironmentTubeSegmentBlueprints[Random.Range(0, currentEnvironmentTubeSegmentBlueprints.Length)];
_pools.pool.CreateEntity()
.ApplyBlueprint(tubeSegmentBlueprint)
.AddId(newTubeSegmentId)
.AddPosition(position)
.AddRotation(rotation);
This code filters the blueprints that match criteria, then selects a random blueprint from selected ones and creates an entity from that blueprint.
This code could be much more simple and neat if I could access blueprint components and their values same as entity components: blueprint.startEnvironment.type, and check if blueprint has a component like this: blueprint.hasTubeSegment.
related #267 JSON Blueprints
Update:
I will drop support for BinaryBlueprints in favour of a text-based format. Blueprints might turn out to be Unity only, so we can use Unity's serialization mechanisms (e.g. ScriptableObject). This should improve the current issues with binary blueprints and the problems when migrating to newer versions.
Will these changes make it possible to have Blueprint component fields save references to UnityEngine.Object types such as assets and ScriptableObjects? That'd be a big win!
No further development on Blueprints for now, see #390 Blueprint sources will stay in the repo so they can be extended.
Most helpful comment
It's all bugs I found at the moment.
Blueprints are very cool :)