[SOLVED] IConvertGameObjectToEntity not found

i am trying to mimic sample provided in github. but i can’t reference IConvertGameObjectToEntity

below is code i try to write

using unity 2018.3.14f1
with unity entities 0.0.12 - preview.24

using System;
using Unity.Entities;
using UnityEngine;

public class PlayerAxisInput : MonoBehaviour, IConvertGameObjectToEntity
{ }
class PlayerAxisInputSystem : ComponentSystem
{
    struct ReqComponent
    {
        public PlayerAxisInput axis;
    }
    protected override void OnUpdate()
    {
        var input = new Vector2(Input.GetAxis("Horizontal"), 0);
        foreach (var e in GetEntities<ReqComponent>())
        {
            // e.axis.InputVector = input;
        }
    }
}

the convert haven’t written yet. since i can’t even reference interface i want

You’re on a very old version of the entities package. You need to update Unity to 2019.x and get a newer version of the entities package.

Entities now requires 2019.1+

oof i see . i thought i could just easily use it as long as it provided in UPM

The conversion pipeline was introduced after the 0.0.12-preview.24 and require Unity 2019.1 or newer. Also GetEntities was discontinued and removed in newer versions of the entities package.

Unless you are trying to use DOTS on a project with frozen 2018.3 version, you should take a look in the sample

[ ]'s

Edit: @tertle was faster

thankfully i just only just started trying it out. well thanks anyway

So i just downloaded 2019.1.13f1 from unity hub and trying to just hotplug my mostly 2018 empty project. it doesnt seems to fetch up iconvertgameobjecttoentity even though i have already removed and re installed it. including removing and adding reference for assembly definition

What the version after updating the Entities package? Should be preview-0.1.1.
You should also install the Hybrid Render package otherwise you will need your own DOTS render system.

[ ]'s

it is preview-0.1.1.
also installed hybrid render package. but still i can’t seem to reference it.

Edit :
so i found out that removing folder .asmdef, solved my issue. which mean i havent referenced unity entities properly, asmdef. is there any other asmdef i needed to reference in order to use IConvertGameObjectToEntity ?

below is .asmdef for folder files resides in

{
    "name": "Source",
    "references": [
        "Unity.Entities"
    ],
    "optionalUnityReferences": [],
    "includePlatforms": [],
    "excludePlatforms": [],
    "allowUnsafeCode": false,
    "overrideReferences": false,
    "precompiledReferences": [],
    "autoReferenced": true,
    "defineConstraints": [],
    "versionDefines": []
}

IConvertGameObjectToEntity is in Unity.Entities.Hybrid

Tip: Even if you don’t have the correct package referenced and while you can’t add the reference via the IDE (Unity will still throw an error and as soon as project is recreated it’ll be removed) it is often smart enough to know what to reference

4837721--464486--upload_2019-8-9_12-7-16.png

Then you can just manually add it to the asmdef. This makes it pretty easy to find what you need to add.

2 Likes

ah finally got it running. no wonder i can’t find iconvertgameobjecttoentity even through file search. file name doesnt even using I prefix.

now i feel really silly. thankyou so much for the help

unfortunately vscode doesn’t seems able to do those tips. :frowning:

Unfortunately that’s the difference between a code editor and an integrated development environment

I assume you’re on MacOS if you’re using VSCode.
I highly recommend Rider for Unity development these days as it just has a lot more support (though I haven’t tried MacOS version but I’d assume it’s the same). If you happen to be a student it’s also free.

Yep is the same as on Win, I use Rider on mac and Win, only annoying difference - hotkeys :slight_smile: Always forgot some hotkeys or mix them in my mind :smile:

Very confusing that it’s in Unity.Entities.Hybrid asmdef but namespace is Unity.Entities. Wouldn’t have to google it if it was split. Similar issue with Unity.Collections and NativeStrings.

1 Like