Search Issue Tracker
Fixed in 2018.2.X
Votes
0
Found in
4.3.0f4
Issue ID
578435
Regression
No
The editor silently fails when a serialized field is type-mismatched
To reproduce:
BUGGY SCENARIO:
1. create new game objects ObjA and ObjB
2. make the following component, TestScript.cs:
using UnityEngine;
public class TestScript : MonoBehaviour
{
public GameObject obj;
}
3. Attach TestScript to ObjA
4. Attach a SphereCollider to ObjB
5. Drag ObjB into ObjA's public field
In the script, change the GameObject to a SphereCollider.
Result:
- Unity continues to think the reference is valid, showing "ObjB" in the
field.
- Various operations on the object/reference do not work as they should, as
the object is now corrupted.
To see the difference(correct behaviour):
1. create new game objects ObjA and ObjB
2. make the following component, TestScript.cs:
using UnityEngine;
public class TestScript : MonoBehaviour
{
public SphereCollider obj;
}
3. Attach TestScript to ObjA.
4. Attach a SphereCollider to ObjB.
5. Link click ObjA and drag ObjB into the public field.
6. Modify TestScript.cs and change SphereCollider to GameObject.
Result:
- Unity shows in the ObjA.obj field: "Type mismatch"
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Standalone Player crashes with "TDerived GetOrLoad<TDerived>() where TDerived : T" when IL2CPP Code generation is set to "Faster (smaller) Builds"
- IndexOutOfRangeException and InvalidOperationException when logging XML string
- Script missing in "Assets/Settings/Mobile_Renderer/GlobalVolumeFeature" of "com.unity.template.urp-blank" template
- “Font Asset Creator - Error Code [Invalid_File_Structure]…“ error is logged when generating Font Assets from fonts with meta files from previous Editor versions
- Input.mousePosition returns (NaN, NaN, 0.00) when Scene view is opened
Add comment