We see how to DEFINE A VARIABLE inside a Script in Unity, to make this variable APPEAR IN THE INSPECTOR and in this way we can DRAW a GameObject to that variable in the inspector.
This method allows us to store the reference of a GameObject in a GameObject type variable, but we can also store any component we need, for example if we define an AudioSource type variable and we make it appear in the inspector, we can drag a GameObject to that variable, if the GameObject we drag has an AudioSource component in that case Unity will automatically extract the reference of the AudioSource assigned to that GameObject and we will have that specific component of the scene assigned to that variable.
Drag and Drop a GameObject in an inspector variable in Unity is one of the simplest ways to find the reference of an object or component to use in a script, this method requires that such objects and components exist in the scene at the design stage.
If the object that we want to reference does not exist during the design stage, for example an object that is instantiated during the execution of the game or application (at run time) this method of assigning a GameObject in a variable of the inspector will not work.
INTRODUCTION VIDEO OF THE REFERENCE SERIES IN UNITY:
• Video
ARTICLE ON HOW TO DRAG AND DROP OBJECTS IN THE INSPECTOR IN UNITY:
https://gamedevtraum.com/en/game-and-...
____________________________________________________________
LINKS
Portfolio: https://gamedevtraum.com/es/portfolio...
LinkedIn: / gamedevtraum
Descargas: https://gamedevtraum.itch.io/
Contacto 1: [email protected]
Contacto 2: / gamedevtraum
____________________________________________________________
In questa pagina del sito puoi guardare il video online Drag and Drop a GAMEOBJECT or COMPONENT in an INSPECTOR VARIABLE in Unity della durata di ore minuti seconda in buona qualità , che l'utente ha caricato GDT Solutions ES 14 gennaio 2021, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 4,547 volte e gli è piaciuto 47 spettatori. Buona visione!