- Home /
Error on build
I get the following error when attempting to build:
Assets/Scripts/Misc/Joystick.cs(129,41): error CS0115: `UnityEngine.UI.Joystick.OnValidate()' is marked as an override but no suitable method found to override
Here is the portion of the script it is referring to:
protected override void OnValidate() {
base.OnValidate();
UpdateJoystickGraphic();
}
What should I do to fix this? I attempted erasing override from the void, but I got a warning saying:
Assets/Scripts/Misc/Joystick.cs(129,32): warning CS0114: `UnityEngine.UI.Joystick.OnValidate()' hides inherited member `UnityEngine.EventSystems.UIBehaviour.OnValidate()'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword
Then I get this error:
Assets/Scripts/$$anonymous$$isc/Joystick.cs(130,30): error CS0117: `UnityEngine.EventSystems.UIBehaviour' does not contain a definition for `OnValidate'
and this warning:
Assets/Scripts/$$anonymous$$isc/Joystick.cs(129,36): warning CS0109: The member `UnityEngine.UI.Joystick.OnValidate()' does not hide an inherited member. The new keyword is not required
OnValidate supposed to be called in Editor only afaik. By any chance you removed a part #if UNITY_EDITOR ... #endif
what is line 129 and 130?
129 is the protected override void and 130 is the one below.
Answer by Positive7 · Jul 27, 2015 at 11:28 PM
Replace it with :
#if UNITY_EDITOR
protected override void OnValidate()
{
base.OnValidate();
UpdateJoystickGraphic();
}
#endif
Answer by remembadaname · Feb 04, 2018 at 11:10 PM
I am getting a similar cs0115 error in this
I cant remove the override either so i dont know what to do and the answer above looks the exact same as his problem...
Your answer
Follow this Question
Related Questions
[Solved] Boolean is true and flase every frame 3 Answers
Error building Player: CommandInvokationFailure: Failed to build apk. See the Console for details () 1 Answer
Why won't unity remote 4 work for me? 0 Answers
Android build error unity 5.4 b15 0 Answers
Unity freezes on Packaging assest:sharedassets0.assest 2 Answers