W
W
WeBBeW2020-12-25 16:41:37
Unity
WeBBeW, 2020-12-25 16:41:37

How to hang up a script to the created object?

I create here so empty object And I want to hang up a script on this empty object. How can I do that? I can't find it on the internet
GameObject Empty = new GameObject();

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GFX Data, 2020-12-25
@WeBBeW

SphereCollider sc = gameObject.AddComponent<SphereCollider>() as SphereCollider;

https://docs.unity3d.com/ScriptReference/GameObjec...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question