i’m trying to access an entity via mono, i’m trying some examples but noticed something, start and awake don’t work. That is, I create an empty object in the entity scene and put a script on it
using Unity.Entities;
using UnityEngine;
public class Test : MonoBehaviour{
private void Awake(){
Debug.Log("Awake");
......
}
private void Start(){
Debug.Log("Start");
......
}
}
but it doesn’t show anything on log…
Am I doing something wrong, or how does it actually work?
There are no MonoBehaviours in entites subscene. Every GameObject is converted into the entity. Every MonoBehaviour that has baker is converted to component of this entity. Everything other is stripped out.
how should it work?
I just need to create an object through which I will transfer data to entities and back, how to do this?
I can’t find working examples…
It will work if GameObject resides out of entites subscene. I cannot suggest particular example, but you may look into CompanionGameObject implementation of Entities package (Unity.Entities.Hybrid\Injection\CompanionGameObject.cs, Unity.Entities.Hybrid\CompanionGameObjectUpdateSystem.cs).
it seems to me that the developers of entities need to change their name, due to the fact that there are several versions of them in use ( 0.17, 0.5, 1.0), in the search for many examples do not understand which version they belong to, this is very, very, difficult to study, for those who don’t know how it works it’s very confusing…
Old versions are history now. Unless you are in the middle of production of your game already you shouldn’t bother with those (0.17, 0.51) Entity packages. If you are studying now it is strongly advised to use only the latest version.
here is what is written in the upgrade (0.5 to 1.0)
Runtime conversion Runtime Conversion will be fully removed for 1.0 and the only way to use Baking is through Sub Scenes. This means that ConvertToEntity and GameObjectConversionUtility.ConvertGameObjectHierarchy don’t work with Baking.
I understand that before version 1.0 it was possible to move data, but now it’s not, so I’m looking for answers through the search and find only early versions of the solution, but this doesn’t make sense since it doesn’t work on 1.0 anymore …
(maybe I misunderstood, I’m just learning)
I don’t understand at all whether it’s possible now (on version 1.0.0-…) to move data between entities and mono, it seems to me that I’m looking for something that simply doesn’t exist …
if there is any solution, then at least I would get some kind of tip, I just don’t know where to look anymore …
I’m stuck…
I use the latest version, but as soon as I need examples, I look for them in the search, and I get a lot of examples from older versions, so I’m confused.
I can’t find what I need on the topic…
This would never have worked inside of a subscene, regardless of the version. Subscenes have always converted gameobject data(and subsequently destroyed those gameobjects) into entities.
I think it should still work when the gameobject is outside of a subscene.