Hey everyone,
Whilst playing in the editor, my break hit result for phys mat/surface type returns a named string to correspond with the material name I set in the project settings (soil, concrete, water, etc). Perfect!..
Unfortunately when playing in a launched/packaged version of the project, the surface type is no longer being output as these names and the output becomes much less useful numbered strings such as: SurfaceType1, SurfaceType2, etc
This is breaking my systems that depend on identifying the material type. Is this a bug or intended behavior for a packaged/launched project?
!
James
Hi CubitStudios,
I was unable to reproduce your issue. To test this I followed these steps:
- Open a blank project
- Create a physics material and name it Glass
- Create a material with the Physics material labeled Glass assigned
- Create an actor that has a sphere static mesh component set to simulate physics
- In the Actor Even graph create a hit event and break the hit result, then pull off from physics material and print the display name
- Place the actor in the scene and apply the material to the default floor mesh below
- PIE, Play in standalone game, Launch, and package for windows(64-bit)
After testing I was able to print out the correct physics material name every time.
Are you packaging for windows (64-bit)? Could you provide a screenshot of your Blueprint system that reads the hit result? Also, are you able to reproduce this in a blank project with the minimum assets needed?
,
Ed
Hello Ed, for investigating. I was able to reproduce this issue on a blank project with the first person example content included. It may be related to the projectile movement / Bounce hit event rather than standard physics impacts.
I have uploaded the test project here for you to try out:
https://www.dropbox.com/s/5k3pxbjayzp9zat/HitTest.zip?dl=0
If you open the level and shoot the projectiles, you will notice a return of either “metal” or “default” upon the ball bouncing, however if you launch the project, you should notice these hit results changing to 'Surfacetype16 and Surfacetype_Default".
edit: Yes, I’m packaging for x64 windows.
Okay, I adjusted the test slightly and was able to reproduce the issue. The report has been logged here: Unreal Engine Issues and Bug Tracker (UE-37454)
You can track the report’s status as the issue is reviewed by our development staff.
I can think of two ways you can get around this. First, is to use the display names of the Phys Materials rather than the assigned surface type. The correct Phys Material name seems to display in packaged games.
Second, just account for the surface type number for each surface type. Example: SurfaceType23 = gravel
Instead of checking fir gravel check for SurfaceType23. If you are concerned with it returning Gravel instead of SurfaceType23 in PIE you can convert enum to name before you convert to string and it will always return SurfaceType.(see screenshot)
Cheers,
Just following up, this has been labeled as “By Design” here is what the developers mentioned. “DisplayNames for Enums are only available in editor builds. I agree this is confusing, but user should use an enum comparison, rather than a string comparison.”