Comments (5)
The following compiles just fine, are you missing API_STRUCT()
from the Attribute
struct?
API_CLASS() class GAME_API Item : public Script
{
API_AUTO_SERIALIZATION();
DECLARE_SCRIPTING_TYPE(Item);
API_STRUCT() struct GAME_API Attribute
{
DECLARE_SCRIPTING_TYPE_MINIMAL(Attribute);
};
// [Script]
void OnEnable() override;
void OnDisable() override;
void OnUpdate() override;
};
API_STRUCT() struct GAME_API RuntimeItem
{
DECLARE_SCRIPTING_TYPE_MINIMAL(RuntimeItem);
API_FIELD() Array<Item::Attribute> Attributes;
};
from flaxengine.
The following compiles just fine, are you missing
API_STRUCT()
from theAttribute
struct?API_CLASS() class GAME_API Item : public Script { API_AUTO_SERIALIZATION(); DECLARE_SCRIPTING_TYPE(Item); API_STRUCT() struct GAME_API Attribute { DECLARE_SCRIPTING_TYPE_MINIMAL(Attribute); }; // [Script] void OnEnable() override; void OnDisable() override; void OnUpdate() override; }; API_STRUCT() struct GAME_API RuntimeItem { DECLARE_SCRIPTING_TYPE_MINIMAL(RuntimeItem); API_FIELD() Array<Item::Attribute> Attributes; };
I have it in the source but i striped from ishue for redability
[Edit] DECLARE_SCRIPTING_TYPE_MINIMAL is incorect for struct btw
Compiler on c# is yeling abaut this
Item.AttributeMarshaller.Item.AttributeInternal
It needs to be like this
Item.AttributeMarshaller.AttributeInternal
from flaxengine.
I think, for structs you should use DECLARE_SCRIPTING_TYPE_STRUCTURE
.
from flaxengine.
found the place for a patch
BindingsGenerator.CSharp.cs:~1640
this will fix it
string originalElementType = originalType[0..^2];
if (internalType)
{
// Marshal blittable array elements back to original non-blittable elements
string originalElementTypeMarshaller = originalElementType + "Marshaller";
//[Nori_SC note]
//Find all characters after last . as a example if the c++ type is Class.Struct it will generate a invalid c# code
//with will look like this <Class>.<Struct>Marshaller.<Class>.<Struct>Internal
//valid code looks like this <Class>.<Struct>Marshaller.<Struct>Internal
var startindex = originalElementType.LastIndexOf('.') + 1;
string internalElementType = $"{originalElementTypeMarshaller}.{originalElementType[startindex..]}Internal";
from flaxengine.
The final code that reproduces the issue:
API_CLASS() class GAME_API Item : public Script
{
API_AUTO_SERIALIZATION();
DECLARE_SCRIPTING_TYPE(Item);
API_STRUCT() struct GAME_API Attribute
{
DECLARE_SCRIPTING_TYPE_MINIMAL(Attribute);
API_FIELD() String foo;
};
// [Script]
void OnEnable() override;
void OnDisable() override;
void OnUpdate() override;
};
API_STRUCT() struct GAME_API RuntimeItem
{
DECLARE_SCRIPTING_TYPE_MINIMAL(RuntimeItem);
API_FIELD() Array<Item::Attribute> Attributes;
};
from flaxengine.
Related Issues (20)
- QoL - Consistent unit of measurement on character controller HOT 1
- Importing normals of fbx meshes done in Blender 4.x broken HOT 1
- TextBox: Wrong text highlights with center and far horizontal alignment
- [ Feature Request ] Add option to apply specific change on prefab HOT 1
- [Suggestion] Material Function Input Ordering
- Third-Party Libraries Failing to Load Assemblies in Cooked Game HOT 1
- Adding a newline into a `[Header]` attribute cuts off the displayed text
- Issues with selecting a csg brush in the viewport
- EXR file import crashes the editor HOT 2
- [Feature Request] Change SDF distance without enabling DDGI HOT 1
- [Bug?] Something is wrong with the graphics HOT 5
- [Feature Request] Import multiple UV Channels HOT 1
- Cannot deserialize ... from Json Asset because it doesn't implement ISerializable interface. but is implemented HOT 3
- Suggestion: Adopt reversed-Z HOT 1
- The HDR in the engine is REVERSED!!!
- [Bug] Metallic materials aren't affected by Skylight HOT 5
- Nested arrays serialization/display issues HOT 4
- TAA+Downsampling is broken
- UV-flipbook is broken. The sequence is broken if the frame number is not rounded to integer and on the vertical border.
- [CRASH][SCRIPT] Crash when writing serializers for nested structures HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flaxengine.