Search Issue Tracker
By Design
Votes
1
Found in
2021.2
2021.2.0f1
2022.1
Issue ID
1378385
Regression
No
Can't create a new button for each element of the list when using ScriptableObject script
Reproduction steps:
1. Open the user's attached project
2. Select Assets > Plugins > Scripts > "Skills" ScriptableObject
3. Open the "Relies On Skills" list and add new items
Expected result: List full of buttons
Actual result: One Button in the list
Reproduced in: 2021.2.5f1, 2022.1.0b1
Could not test with: 2019.4.33f1, 2020.3.23f1 (error about an inability to change string to char)
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Crash when trying to force Shader to interpret 1/30 as a floating point operation
- Terrain is flickering when adjusting "Compatibility Mode" and "Use Rendering Layers" Settings
- Isometric tiles are flickering and overlapping each other when entering Play Mode with Tilemap Renderer mode set to "Chunk"
- Crash on ParticleSystemParticles::array_reserve when particle system starts
- Docking Text Property Preview Window next to UI Builder breaks the window and causes NullReferenceException
Resolution Note:
Since PropertyDrawers are shared between all instances, CreatePropertyGUI() needs to always returns a new VisualElement. Here is a modified version of the custom property drawer that will allow you to edit each value independently.
[CustomPropertyDrawer(typeof(SkillHolderSerialized), true)]
public class SkillHolderSerializedDrawer : PropertyDrawer
{
public override VisualElement CreatePropertyGUI(SerializedProperty property)
{
var container = new VisualElement();
CreateSkillEditor(container, "skill.");
return container;
}
public static void CreateSkillEditor(VisualElement container, string bindingPathPrefix)
{
var uuid = new IntegerField()
{
label = "Uuid",
bindingPath = $"{bindingPathPrefix}{nameof(Skill.uuid)}"
};
container.Add(uuid);
var nameField = new TextField()
{
label = "Skill Name",
bindingPath =$"{bindingPathPrefix}{nameof(Skill.skillName)}"
};
container.Add(nameField);
var descriptionField = new TextField()
{
label = "Skill Description",
bindingPath = $"{bindingPathPrefix}{nameof(Skill.skillDescription)}",
multiline = true
};
container.Add(descriptionField);
}
}