#Creating singleton data in a baking system.

1 messages · Page 1 of 1 (latest)

radiant charm
#

Heya, how can I generate a singleton entity from a baking system? It doesn't work when I simply use the entity manager to create an entity, I assume that's because the entity is generated in a separate baking world. I was wondering if it's possible to create an entity in a baking system for runtime.

dawn fiber
#

singletons aren't really a 'thing'

radiant charm
#

Im well aware

dawn fiber
#

it just means only 1 of this combination of components exist

radiant charm
#

just creating new entities in general

dawn fiber
#

so a singleton in baking is just, bake 1 copy of the entity

radiant charm
#

is it not possible without creating another game object in the heirarchy to bake then?

dawn fiber
#

if the question is actually, how do you instantiate entities in baking that's a very different question that is kind of complicated

#

but is actually doable

#

the problem is, how do you define what susbcene to put it in?

#

unless your project only has 1 subscene it has to be linked to something

radiant charm
#

true

dawn fiber
#

if you its linked to something, easiest way is to just CreateAdditionalEntity and set it up

#

it is possible to truly create an entity from scratch in baking systems

#

you just need to add SceneSection

#
    public struct SceneSection : ISharedComponentData, IEquatable<SceneSection>
    {
        /// <summary>
        /// Unique GUID that identifies the scene where the section is.
        /// </summary>
        public Hash128        SceneGUID;
        /// <summary>
        /// Scene section index inside the scene.
        /// </summary>
        public int            Section;```
#

and writing the subscene guid to it

radiant charm
#

Ah right