There is this problem in all my projects. How to fix it?
Do you have the parent gameobject (in the hierarchy pane) selected or the script itself (in the project pane) ?
same problem and I have the script selected
It’s not a problem. You don’t normally set references on the script. Instead set them on the GameObject the script is attached too.
But there still seems to be a problem so if you could tell me how to fix this it would be very helpful
I’m not psychic. You need to tell me what the problem is before I can solve it.
So I am a complete noob when it comes to unity.I was watching this tutorial of an endless runner game on youtube(gamesplusjames).I finished making the game and everything worked fine.But then stupidly I tried to make a character select screen and I deleted the player that the game was being played with to make new ones.I made new characters and followed the steps again but now my player is completely messed up.The playe is now jumping even when hes not on the ground even tho groundcheck is in place.Player is also not collecting coins.I deleted everything related to the character select thing but its still not working.Any help would be appreciated.I am dyinga,ahhhh.
Someone help please
The Inspector exposes these public fields two places: the script’s Inspector page AND the GameObject’s Inspector page.
SELECT the GameObject that you want to assign to in the Hierarchy and then drag your Prefab to the field exposed in the Inspector.
It happened to me aslo.You can try not to change the references in Script,instead changing on object. Add component Script (C# or java) on your object, and see what will happen .then try to change it in object`s Inspector .
93/5000
I have two scripts and it says there is an instantiation error, this GridSpace and GameController
you need to select your Game_object in Hierarchy than drag the script in this Game_Object your problem will be solve
Hi, I’m using Unity 5.6 and need to set references to shaders on scripts, as those scripts use them as ‘caches’.
Is it possible to disable this to allow the script to reference the shaders? Thanks in advance!
I am also curious if it is possible to access script-references in play mode.
In my case, I have a custom EditorWindow that references a .guiskin-file in the project. Because EditorWindows are not in the Hierarchy (or instantiated from prefabs) there is no obvious GameObject where I can set the reference.
Setting the .guiskin-file reference on the script directly works if I open the window while in edit mode, but if I try to open the window in play mode I get a null reference for the guiskin.
I have a problem!! That If I use simply a scrip and reference it prefab it works nearly perfect but whenever i tries to add same scrip on prefeb as a reference it hang up and dont let it done… More over i am still not clear about Default reference will be applied only in edit mode?? Is it mean that whenever i will play, this will erase the reference… I am done i can’t visualize more plzz if you have stamina so help me out plzzzzzzzzzzzzzzzzzzz
Thanks
Hi, I had the same problem, the solution is to create an empty game object in the hierarchy then drag and drop the script on that game object, thus you can solve the problem.
the cause of the problem that you are not able to edit the script in the game assets.
Thank you! This was killing me!
Thank you so much bro I have been browsing the internet for almost 3 hours. Thank you so much
Hi, after investigating a bug I found this thread about Default References and wanted to add some extra information for future people stumbling on this thread.
Taking @kingstone426 example using CustomEditor with Default Resources, if the custom editor are in a none editor-only assembly, the Default Reference set in code will be null when in Playmode.
If the assembly is Editor-Only (ie. /Editor folder not covered with no asmdef) it will work in Playmode as well. We have some special behavior for this exact scenario.

