Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blueprints Phase II #102

Closed
sschmid opened this issue Apr 15, 2016 · 12 comments
Closed

Blueprints Phase II #102

sschmid opened this issue Apr 15, 2016 · 12 comments
Assignees

Comments

@sschmid
Copy link
Owner

sschmid commented Apr 15, 2016

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.

@sschmid
Copy link
Owner Author

sschmid commented Apr 17, 2016

If you already tested Blueprints Beta you can drop your feedback here. Does it work? Any pain points? Bugs?

@grygus
Copy link

grygus commented Apr 21, 2016

It would be nice to have event firing when Blueprint inspector is updated in playmode, that would give a possibility to test blueprints live.

@sschmid
Copy link
Owner Author

sschmid commented Apr 21, 2016

@grygus on my list now :) thanks

@vladpazych
Copy link

  1. When creating new blueprint and typing it's name right away, after "Enter" name becomes "New Blueprint" again.
  2. When renaming blueprint in it's field - it looks like it saves assets after each letter typed - IMO better to save it manually with "cmd + s".
  3. Sometimes (I have not figured out when exactly) VisualDebugger Pools appears in Edit Mode.

It's all bugs I found at the moment.

Blueprints are very cool :)

@vladpazych
Copy link

vladpazych commented Apr 27, 2016

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.

@Kabie
Copy link

Kabie commented Apr 27, 2016

It seems that it only generates one blueprints class. I was hoping it would generate one blueprints class for each blueprints.asset file.

@dimixar
Copy link

dimixar commented Aug 10, 2016

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

@sschmid sschmid removed the ready label Sep 22, 2016
@alandyshev
Copy link

alandyshev commented Oct 1, 2016

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.

  • In Unity you can work with prefabs same as with instances: you can access any values from them. I'd like Blueprints to have the same interface as Entities.

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.

  • When I create new blueprint it's created in the root folder, not in the folder where I create it. And the name I give to it when creating is not saved. I need to rename it then.
  • When I save Unity scene by pressing Ctrl + S blueprints are saved as well. Then when I commit code to git it commits all blueprints since they've changed.

@sschmid
Copy link
Owner Author

sschmid commented Jan 31, 2017

related #267 JSON Blueprints

@sschmid
Copy link
Owner Author

sschmid commented Apr 9, 2017

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.

@sschmid sschmid closed this as completed Apr 9, 2017
@ophilbinbriscoe
Copy link

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!

@sschmid
Copy link
Owner Author

sschmid commented Apr 26, 2017

No further development on Blueprints for now, see #390 Blueprint sources will stay in the repo so they can be extended.

@sschmid sschmid added this to Entitas Jul 2, 2023
@github-project-automation github-project-automation bot moved this to Todo in Entitas Jul 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

7 participants