I managed to add Unity components by replacing the .Light, but how do I add my own components at run-time?
You can use the "Add Component" action, which works for both Unity and custom components. You just need to write down the name of the component and it will be searched and added to the targeted game object.
Entering only the name of the script did not work. Do I need to include a namespace? By default, it says "UnityEngine.Light, UnityEngine" which confuses me. This action could use a bit more explanation in the docs.
Yes, it needs to include the namespace and the name of the component. This is a bit confusing, as it needs to talk to the engine and make use of reflection. The nomenclature is "[Namespace].[Component], [Namespace]". However, I think that for custom components (the ones you create from script), using the name of it should suffice.
my script dont have any namespace. then how i can access it. my code of script is simple. and i want to call it using condition to add into gameobject. Mean to say on condition base i want to add my "scriptfile.cs" to gameobject.
After a long time the answer from someone at Discord give me a solution and guide me the usage of Add Component.
format for script file having no namespace e.gclassname, Assembly-CSharp
Customer support service by UserEcho