I have a Unity project with warnings:
The referenced script on this Behaviour is missing!
I've identified which game objects have these bad references, and I have a collection of scripts (cs files) which I know include the intended scripts, but which component instances (and their saved state) map to which scripts I cannot discern obviously.
Is there a way to know which scripts the components with missing references were originally pointing to, so I can manually reassign the correct scripts back onto the components and preserve component state?
Click Regenerate project files In the Unity Project window, double-click one of your scripts. Unity automatically regenerates the solution file along with all project files.
Description. MonoBehaviour is the base class from which every Unity script derives. When you use C#, you must explicitly derive from MonoBehaviour.
Make sure in the Editor Settings the Asset Serialization Mode is on “Force Text”.
You could open up your scene (or prefab) file in a text editor and search for the GameObject name with the missing script reference e.g. “TheGameObjectWithTheMissingBehaviour”
you should see something like this (i just copied down the important lines)
--- !u!1 &298606752
GameObject:
m_Component:
- 54: {fileID: 1199074165}
- 114: {fileID: 1199074166}
m_Name: TheGameObjectWithTheMissingBehaviour
---
below the GameObject there should be a list with at least one MonoBehaviour, which looks like this
--- !u!114 &1199074166
MonoBehaviour:
m_Enabled: 1
_myCustomVariableA: 1
_myCustomVariableB: 2
_myCustomVariableC: 2
---
you can see in the last lines there are the custom variable i.e. [SerializedField] or public members.
then you could search your project for a script with those custom variable name.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With