Description

SetMaterial allows the user to add a Material which updates the GetMaterials array but not GetNumMaterials.

The user who reported this was trying to add a material to a skeletal mesh during runtime, and believed the Set Material function would do this. I would expect the Set Material to do nothing when given an Element Index outside the length of GetMaterials, and perhaps return an error.

EDIT:
The user has clarified that they were not adding a new material, simply using Set Material to update a material slot clears the slots in the array (though the materials are not actually removed from the skeletal mesh). New clarification image attached.

Steps to Reproduce

1. Open the Content Examples project
2. Set the Default Pawn Class to 3rdPersonPawn in the GameMode Override
3. Open the 3rdPersonPawn BP
4. Create a new Input event
5. Get Mesh > Set Material > choose any material
6. Get Mesh > Get Num Materials > Set Material Element Index
7. Get Mesh > Get Materials > For Each Loop
8. Get Display Name for each Element > Print String
9. PIE
10. Press the input key
11. Press the input key a second time

Results:
Set Material adds a slot to the array with the new Material assigned, but each of the original slots are emptied. The GetNumMaterials array is never updated with the new number of materials (presumably because it shouldn't actually be changeable).

Have Comments or More Details?

Head over to the existing Questions & Answers thread and let us know what's up.

0
Login to Vote

Fixed
ComponentUE - Gameplay
Affects Versions4.74.8
Target Fix4.8
Fix Commit2483638
CreatedJan 15, 2015
ResolvedMar 18, 2015
UpdatedApr 27, 2018
View Jira Issue