Hi ! ^^
I want to create a gameObject when a interruptor is activated and I looked at the manual for this. I found how to create a new gameObject and how to give ita boxcollider or a rigidbody.
Can somebody tell me how to give a sprite to this new GameObject ? ^^
Thanks for your answer ^^
Good day @Bohemond !
I recommend you to watch more tutorials and read more manuals before commence asking things, because here is to solve problems, not basic things.
But i will help you anyway:D
You want to know how to add a sprite to a GamObject in the inspector Editor? or via scripting during Runtime?
For Do this in editor, you need to create a Material, and asign your sprite to this material. Then attach the material to the GameObject.
Hi @tormentoarmagedoom ^^
It’s kind to you to answer to a beginner like me
Fortunately, I’m not so incompetent in Unity and I know how to give a sprite to a game object in the hierarchy view ^^
I wanted to know how to give, via a script, a sprite to a game object jste created during the game by the script.
Thanks to the manual, I found the command .AddComponent and I can give a sprite renderer to a gameObject created during the runtime but I don’t know how to give it a sprite via the code ^^