0

I want to keep player name in IComponentData

public struct PlayerNameTag : IComponentData {
    public string playerName;
}

but I get the following error: ArgumentException: Components.UITags.Creation.PlayerPortraitTag contains a field of System.String, which is neither primitive nor blittable.

Where I must keep string datas?

nuclear kote
  • 480
  • 7
  • 16
  • Because strings are not [primitive](https://stackoverflow.com/a/3965758/1663383) nor [blittable](https://learn.microsoft.com/en-us/dotnet/framework/interop/blittable-and-non-blittable-types). – Draco18s no longer trusts SE Dec 04 '19 at 17:23

1 Answers1

3

I believe NativeString creates an unmanaged blittable string and is usable in IComponentData.

Erik Overflow
  • 2,220
  • 1
  • 5
  • 16