Search Issue Tracker
Fixed in 2020.1.X
Votes
0
Found in
2020.1.0a7
Issue ID
1189349
Regression
Yes
Script is not recognized as a MonoBehaviour if it contains string concatenations in a lambda inside #if UNITY_EDITOR block
How to reproduce:
1. Open the user's attached project
2. In the Project window, reimport the "MonoBehaviourThatBreaksTheParser" script
Results: The script shows a "No MonoBehaviour scripts in the file" error
Reproducible with: 2020.1.0a7, 2020.1.0a8
Not reproducible with: 2017.4.32f1, 2018.4.11f1, 2019.2.8f1, 2019.3.0b5, 2020.1.0a6
Note: The error is caused by the following line inside a #if UNITY_EDITOR block:
Utils.HelperMethod(() => $"{Utils.SomeMethodThatReturnsString()}");
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
- [OpenGLES][XR] Zooming in on the camera's URP opaque texture causes "double vision" on Quest in OpenGLES3
- “[Worker0] Could not generate preview image“ error when opening macOS native plugin in the Inspector with Architecture to build for set to ARM 64-bit
- [iOS] Application.absoluteURL is empty on Awake/Start when opening via deep link with Splash Screen disabled
- Crash on MemoryManager::Deallocate when rapidly calling Addressables.LoadAssetAsync
- Crash on physx::shdfnd::atomicIncrement when adjusting values on a character controller component after entering Play mode in Prefab edit mode
Skunkworks-Eetu
Jan 25, 2022 14:54
I am still able to reproduce with a following snippet:
using UnityEngine;
namespace MyNamespace {
public class Test : MonoBehaviour {
#if ANY_CONDITION
private void Execute() {
var str = $"{new[] { "0" }[0]}";
}
#endif
}
}