Search Issue Tracker
Won't Fix
Won't Fix in 2023.3.X
Votes
6
Found in
2021.3.30f1
2022.3.9f1
2023.1.12f1
2023.2.0b8
2023.3.0a4
Issue ID
UUM-47971
Regression
No
Default References of nested Serializable classes are not exposed in the Inspector
Reproduction steps:
1. Open the attached “IN-50785 Default References not exposed.zip“ project
2. Open the “SampleScene”
3. Select the “GameObject” in the Hierarchy
4. Notice that the “Mono (Script)” component in the Inspector has a Material reference from the “Nested” class
5. Select the “Mono” script in the Project window
6. Observe the Inspector
Expected result: The Material reference from the “Nested” class is exposed on the “Mono” script
Actual result: The Material reference from the “Nested” class is not exposed on the “Mono” script
Reproducible with: 2021.3.30f1, 2022.3.9f1, 2023.1.12f1, 2023.2.0b8, 2023.3.0a4
Reproduced on: Windows 11 Pro (22H2)
Not reproduced on: No other environment tested
Notes:
- Reproducible in a new project
- Adding “MonoBehaviour” inheritance to the “Nested” class exposes the Material reference on the “Nested” script but then on the “Mono” script and the “GameObject” it appears as “None (Nested)” and nothing can be referenced through it
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
- “FMOD failed to set the software format to the custom sample rate…” warnings are thrown as System Sample Rate value is being changed in Audio section of Project Settings window
- VFX Marquee selection does match the visual indicator
- “Invalid AABB aabb” errors are spammed when “Infinity” value is entered in Collider Component fields
- Editor Role does not sync with the MPPM Play Mode Scenario Role when entering Play mode
- Long asset names cause overlap with the “Find” function in search result tabs
Resolution Note:
This is by design, only objects that inherrits from UnityEngine.Object is allowed as defaults.
The closes solution to what want is to make the Nested object inherrit from ScriptableObject and then create an instance of it (using CreateAssetMenu attribute and make an instace under Create -> Nested) and assign that instance as the Default reference to the Mono script
[CreateAssetMenu]
public class Nested : ScriptableObject
{
public Material _Material;
}
Resolution Note (2023.3.X):
This is by design, only objects that inherrits from UnityEngine.Object is allowed as defaults.
The closes solution to what want is to make the Nested object inherrit from ScriptableObject and then create an instance of it (using CreateAssetMenu attribute and make an instace under Create -> Nested) and assign that instance as the Default reference to the Mono script
[CreateAssetMenu]
public class Nested : ScriptableObject
{
public Material _Material;
}