Default references will only be applied in edit mode? - c#

It's been a long time since I did something in unity3d but today I opened an old project of mine to build an apk-file from a game I did about a year ago. But as soon as I had opened the project I saw that every reference in my c# scripts were set to None. I can't change them back and my project doesn't work without them. Below that there is an info box which says "Default references will only be applied in edit mode". I really don't know what to do because, like I already said, I didn't worked with unity for a year and I'm not so familiar with all the things. To show you what I mean I added a screenshot below.
It would be awesome if anyone could help me. Thanks in advance.
Screenshot from the reference section in the Inspector of a c# script in Unity3d

Usually the problem get fixed if you open your project with the same version of unity you've been working with a year ago maybe earlier. At this point the damage might already be done, but do you have a back-up for your project? You can start over with that earlier unity version, it will work if you haven't work with it since.

I am considering this only a message, or hint. Once you run the application, the references are getting assigned in the inspector automatically. They even stay when stopping the application, but not after saving or after relaunching unity. Weird behavior.

Related

All my Unity projects contain blank compilation errors (only the timestamps), preventing any projects from working or importing correctly

I really need some help. I was rearranging file locations and trying to clear up some space and somehow broke the ability for Unity to operate on my laptop. The pictures of the errors are below.
This all started when I was moving a completely functional unity project from an external SSD to my internal laptop SSD. I had to clear space for the size of the project and I must have deleted something important, but I have no clue how to tell what it is.
Error seen when opening project
Editor view after opening
Error when trying to attach a script to a GameObject
Error in editor log
Steps I've taken:
I've restarted my computer several times.
I've completely uninstalled all editor versions and the unity hub (twice), including deleting all local app data for unity, emptying the temp bin, and clearing the keys in the registry.
I've started completely new projects, checked
old ones that used to work, downloaded sample ones from unity learn
just to make doubly sure that it's not me being dumb.
My current theory is that this has to do with me clearing some data from a National Instruments folder. I'm new to programming and just read online that these drivers are needed for .NET communication, but would this be why Unity keeps failing then?
This has all taken more than a few hours and I'm struggling to fix this if anyone has any suggestions, please. I'd really appreciate any insight.
Update: I'm able to make new scripts, objects, scenes, etc. but I can't attach any script components to game objects because "the script class can't be found"
Update #2: Checking the Editor logs shows that the Tundra build is failing, and the "93 items updated" matches the 93 errors that are shown. No idea what Tundra is, but that's something to look at now!
Update #3: fairly more certain it's something to do with the .NET interactions, but I'm completely unknowledgeable about this and worried about breaking this further
Answering my own question in case another person finds this and has the same issue, but the problem wasn't .net related or anything I mentioned. I uninstalled anaconda which caused some issues with the Command Prompt, where it would close immediately after opening. Unity uses this for a number of processes, so that's what caused all the blank errors.
The solution is to delete the Microsoft Command Processor AutoRun key in the registry editor.
https://forum.unity.com/threads/unity-empty-errors-on-every-project-unity-2021-3-2f1.1279124/
Cmd crashes with exit code 1 after uninstalling anaconda

Unity Prefab Not Updating On Old Android Tablet

I have a Samsung Galaxy Tab Active 1, on the latest version of android it can handle, and just recently, after adding accessibility features that shouldn’t affect anything, the balls in my game stopped updating. I instantiate a ball, and change a few properties on it, and then for some reason I think it’s not calling the update method. There are no errors.
I’ve heard using PrefabUtility to instantiate might help, but I haven’t done that just yet. I will update if PrefabUtility works.
Any advice?
Whoops, this was due to me being a bit stupid. The main reason it was happening was because of a parsing error in some of the accesibility settings, as they were not saved correctly due to weirdness I can't wrap my head around with files in Android. TLDR: file did not save correctly, and so did not load correctly, and so data messed up, and so it errored before it could do anything.

Unity PlayMaker - Couldn't find Action Script

I've already posted in PlayMaker forum, but I'm not getting any responses. Hoping someone that had the same problem here would see and shed some light.
I am reviving an old project. It's been left untouched for 5 years. So the Unity version is still in 5.2.1f1 and PlayMaker version 1.7.8.3p2
My problem is I cannot open a Custom Action Script. It is showing Couldn't find Action Script in the error. The script won't show if searched in project folders.
The game runs though, and the other PlayMaker preset ActionScripts I can access.
Wondering if I am missing something? Please see the screenshot below. Thank you
see screenshot here
I now have an answer. All the actions were kept inside a single script. Therefore, cannot be searched in the project view. I found it by guessing, but it would be obvious to find it by making a deep file browser search.

Building a UWP app coded in xamarin.forms in release mode results in Internal compiler error: Specified cast is not valid

I've something really annoying happening im my code.
I've built an app in Xamarin.Forms after battling for months with the framework just to find that when I'm now done, I cannot build my app in release mode to deploy it to the Store.
The app works well in debug mode, but does not build in release mode in the UWP project. I have been struggling to find a way to build my app in release mode for 5 days. but no matter which solution I see in all the forums and the stackoverflow questions I encounter, this error won't even blink.
The error which the IDE shows when I build the app in release mode is:
Internal compiler error: Specified cast is not valid.
It does not tell me anything more than that. The IDE doesn't give me any additional error message. I have struggled for days applying solutions I find to similar to this online, but nothing works.
I have updated IDE
Updated all packages
Deleted custom renderers on the UWP project
I went through every portion of code to find where I may have made a bad cast
I tried all I could find online, but nothing works.
I usually don't ask questions on forums unless it becomes critical.
If I don't get any solution, I'll be forced to delete this project and waste the months of coding I did, and abandon Xamarin for ever and move to Flutter which has a better reputation when it comes to tooling.
First of all, please don't fume so much. We understand you are frustrated, but Caps Lock just doesn't help to make us take it more seriously. Also I know Flutter is the new "cool guy in town", but it also has its set of issues. Cross-platform development is not simple and Flutter does support only two platforms, while Xamarin.Forms have a wider reach, which is bound to bring a bit more complexity.
My first suggestion would be to change the build output more verbose in Visual Studio Options, because that could uncover the actual issue here. When it comes to release mode, the problems usually come from types which are used for reflection but the compiler does not see as used and hence throws them away. Usually these errors show up at runtime however. In your case I would suggest a few following things:
First and foremost - try to delete bin and obj folders in your project. That might help, as they sometimes get cluttered with older libraries and create conflicts.
If you have been building with a source control like Git (I hope you did), I would suggest going back to some early commits and then try to build release mode there. If the project builds, jump forward to some newer commit and try again. If it does not, try an even earlier commit. The goal of this is to pinpoint when in time was the error introduced, which should significantly help you in searching where the problem comes from.
If you didn't use any source control - first remember to do so next time. However, this time you will have to do it "the old way". Create a new project and slowly as little code from the original project, trying to do release build at each step. Hopefully this will allow you to find the culprit code and then you will be able to fix it in the original project
You can definitely post your findings here and we will be happy to help you further - like pinpointing the actual problem in the code file once you narrow it down.
I suspect your problem is coming from auto-generated XAML, so definitely make sure to focus on the .xaml files adding them one by one.

SceneManager.LoadScene is crashing for Android Devices

Ok, I've been testing a game with several scenes. In Unity and iOS devices, everything works perfect. In Android, always crash (or freeze if you prefer).
I'm using Unity 2017.2.0f3. and the line of code that crash is the next one (nextScene is a string with the value of the next scene):
SceneManager.LoadScene (nextScene);
I've been trying other options like:
SceneManager.LoadScene (nextScene, LoadSceneMode.Single);
But this is not working neither. The last one I tried was:
SceneManager.UnloadSceneAsync(UIManager.Instance.currentScene);
SceneManager.LoadScene (nextScene, LoadSceneMode.Single);
Again without success. Please I really need help with this. I've dealing with this problem for 24 hours. It's driving me crazy.
After more than 24 hours I solve the problem. I hope that my solution help other people because there isn't enough references on the web.
When I created the APK file it was splitter with a second one of type OBB. This kind of files is required when the Android App is too big. In my case was set by default.
The solution was to force the creation of the APK without the OBB. To do that you must get to Player Settings in Android, go to Publishing Settings and uncheck Split Application Binary (located at the bottom).
Everything's working now and life is good again.

Categories