When (if ever) is this supported? What must I do to make it supported?
Long story short, I noticed that Shader.PropertyToID is marked threadsafe and is static. So I tried to give it a FixedString64Bytes by passing in $"{myFixedString}". This produced the following error:
structs with characters that do not have the 'CharSet=CharSet.Unicode' StructLayout are not supported for external-function functions
Interestingly, the error says nothing about string being managed, which makes me think that this is close to being possible.
For kicks I tried wrapping FixedString64Bytes inside a struct with the specified attribute, but that produced the same error.
1 Like
@DreamingImLatios that error looks like a red herring; Burst doesn’t actually support calling extern methods that have string parameters.
It would be theoretically possible, though, for the relevant team to add a Burst-compatible Shader.PropertyToID overload, such as has been done for ProfilerUnsafeUtility.CreateMarker for example. It needs to be done on a case-by-case basis. If that’s something you’re interested in for Shader.PropertyToID, you could reach out on the graphics forum to make that feature request.
2 Likes
Did you ever figure this out?
I have a struct with a char field and trying to optimize it for Burst jobs and I am getting this same error.