Unity script problem | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Unity script problem

I can’t attach my script because the class is “abstract” How do i fix it?

11th Jul 2018, 7:56 PM
🅿️®️⭕️_e✖️e
🅿️®️⭕️_e✖️e - avatar
5 Answers
+ 1
🅿️®️⭕️_e✖️e I have two prefabs in my current Unity project, all I did was take the object and stick it in a Prefabs folder under assets. I think you can just drag the object from the scene hierarchy into the folder inside the editor and it'll work. Come to think of it, I think a prefab is just any externally (outside of a specific scene) stored game object. Maybe the exact folder it goes into doesn't matter that much
12th Jul 2018, 11:54 AM
Jordan
Jordan - avatar
+ 2
It's because it's static (you're placing the script on an object as a component, so it won't be static). Change that and it should work. Also, make sure that your class is inheriting from MonoBehaviour. If that doesn't work, post up your script to me and I can give you further advice.
11th Jul 2018, 8:04 PM
Fata1 Err0r
Fata1 Err0r - avatar
+ 1
For the prefabs, as he mentioned, you can drag it from the scene hierarchy to your content manager (doesn't matter folder) and it'll create a prefab. You can also create the object directly from the content manager to create a prefab. Also, when you've selected objects in your scene, in the properties on the right, you can just click on "Apply" to save changes to prefab.
12th Jul 2018, 3:54 PM
Fata1 Err0r
Fata1 Err0r - avatar
0
thanks it's now fixed
12th Jul 2018, 10:21 AM
🅿️®️⭕️_e✖️e
🅿️®️⭕️_e✖️e - avatar
0
I have another question for you. how do I turn object into prefab
12th Jul 2018, 10:22 AM
🅿️®️⭕️_e✖️e
🅿️®️⭕️_e✖️e - avatar