+ 2
Unity script problem
I can’t attach my script because the class is “abstract” How do i fix it?
5 Réponses
+ 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
+ 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.
+ 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.
0
thanks it's now fixed
0
I have another question for you. how do I turn object into prefab