Hi,
I am trying to animate a game object, but even after putting a public animator in my script it does not show in the Unity inspector. How so ?
Remove the static. Those never show in the inspector.
ALSO: screenshots of code are not a thing . If you post a code snippet, ALWAYS USE CODE TAGS:
How to use code tags: Using code tags properly
By dragging it into the slot on the instance.
Rather than one of us retyping hours of bland common knowledge in here, go look at pretty much any Unity tutorial at all. It’s like the single-most-common way of connecting EVERYTHING in Unity.
Referencing variables, fields, methods (anything non-static) in other script instances:
Like all inter-script interaction, all you need is:
Script A needs a reference to script B, which you will populate in the editor:
// inside of ScriptA:
public ScriptB myBScript;
Script B needs to have something public that script A can change:
// variable / field inside of ScriptB:
public int myFooInteger;
// function inside of ScriptB:
public void DoStuff( string reason)
{
}
Script A can then change it directly using the reference to B:
// here is ScriptA accessing something in Scrip…
within a class there are reference to gameobjects in the scene A,
the same gameobjects are available in the scene B.
i have dragged the gameobjects in scene A into inspector fields. now how to reference these gameobjects in the scene B via script into relevant fields in the inspector?
please give me some idea. thanls.