Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by inJUST · Jul 24, 2017 at 11:21 PM · errorgameobjectinspectorunity 4.6

Cannot add or drag an asset to the inspector

Having a strange issue where the inspector won’t allow me to attach my enemy prefab. I can only attach it assuming it’s already in the hierarchy which obviously isn’t the correct solution given that we want it as a prefab.

As you can see in the screenshot Enemy is a Game Object already placed in the hierarchy but attempting to drag in a prefabbed object (enemyBlack2) isn't allowed.

I should also add that I attempted to run Unity in both standard and administrator modes.

alt text

capture.png (82.5 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by ThePunisher · Jul 24, 2017 at 11:48 PM

It's possible that your EnemySpawner script is looking for a specific type of object. One that your instanced enemy qualifies as, but not the prefab. Mind attaching a snippet of the code declaring the EnemyPrefab member?

If I had to take a guess I'd say that you're looking for a specific type other than GameObject. And this specific type is something you're attaching to your Enemy instance in your scene Hierarchy, but it's not attached to the prefab. You could try creating the prefab from the Enemy instance in your scene by dragging it over to your asset view.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Bunny83 · Jul 24, 2017 at 11:53 PM 1
Share

Right, or he dragged the wrong object. An imported FBX model imports as GameObject / prefab but also has the $$anonymous$$esh as sub asset. Dragging the $$anonymous$$esh of course won't work. I never use the two column mode of the project view so i'm not sure which of the two things is the gameobject.

avatar image inJUST · Jul 24, 2017 at 11:57 PM 1
Share

public class EnemySpanwer : $$anonymous$$onoBehaviour {

     public GameObject enemyPrefab;
 
     // Use this for initialization
     void Start () {
         // instantiate returns an object but consider it as a gameobject
         GameObject enemy = Instantiate(enemyPrefab, new Vector3(0, 0, 0), Quaternion.identity) as GameObject;
         // change the enemies parent. transform of whatever the enemy transform is, in this case the EnemyFormation
         enemy.transform.parent = transform;
     }

I used the suggested workaround of dragging from the hierarchy to the asset and generating the prefab that way. This seems to be the best solution. The only snag was that I had to reattach a sprite to the enemy asset, by default it prefabbed a blank object.

avatar image
0

Answer by JoaoGracio · Aug 15, 2017 at 05:49 PM

Im having the same problem how did you solve it InJust???

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image inJUST · Aug 15, 2017 at 11:46 PM 0
Share

I used the suggested workaround of dragging from the hierarchy to the asset and generating the prefab that way. This seems to be the best solution. The only snag was that I had to reattach a sprite to the enemy asset, by default it prefabbed a blank object.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

114 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

My gun can't shoot after some adjustments to the script 1 Answer

Y-Positionen angleichen / Align the Y positions 0 Answers

Editing properties of game objects inside an array using the inspector. 2 Answers

Succeded(hr) message in the log 2 Answers

Change Texture of Clone 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges