Cant add an empty script to actor

Hi!!..
i right clicked on source folder of my game, selected New -> C++ script, then added a LOG line on onUpdate method:

void Player0::OnUpdate(){
    // Here you can add code that needs to be called every frame
    LOG(Info, "Hello from C++");
}

then saved it and back to editor, then created an actor and tried to attach my header but forbiden symbol appear it wont let me attach the script… after this i tried clicking “Add Script” button but c++ scripts are not listed…

I’m using v1.0, may am i missing something?

thanks!

1 Like

Can you take a look into Output Log window - does it says something about scripts compilation? After editing your c++ file and going back to Editor it should auto-compile it and put some info there.

1 Like

Thanks, you helped for solution on Discord, after installing Flax, i needed to install MVSC V140 toolset from Visual Studio Installer (aditional components), then i needed to edit the file MyProject.build.cs and change BuildNativeCode from false to true.

3 Likes

I’am unsure do you mean MVSC or MSVC, firstly can’t be found in the installer, i using VS2019 and have already installed some MSVC packages v140 for VS2015 and some corresponding to the newer versions of VS, also some have Spectre libraries for all archetectures including ARM, should i install all of these to be sure, cause i’am trying to add c++ scripting as well followed the documentation page/ wiki of it, but i end up after adding some c++ generated files to be unable to compile the project in VS an error message from MSBuild is poping up. I’am totally new to the Flax Engine, so far it is looking really good, and appreciate the way you opened up more variancy in scripting e.g you can use C# and C++ with Visual Scripting on top of them and interchangebly some what communicate between them, really nice!