Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 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 actraiser3 · Jul 16, 2015 at 02:55 PM · editorruntimedrag-and-drop

How to stack Prefabs in the scene dragged from Project List

Hi,

For a Level Editor which works at Runtime, I want to drag and Instantiate Prefabs from the Editor-Project-List into the Scene. While being dragged they should stack on the surface of existing instantiated objects in the scene view.

The Problem is that the prefabs - while being dragged - are overlapping other objects in the middle. What I basically need is Auto-Surface Snapping of a instantiated object and a Prefab which is dragged nearby. By the way, IsKinematic is turned on, so Objects do not react to Physics during Editing.

I attached screenshots for clarification. Picture 1 shows the behaviour I experience and Picture 2 shows what I want to achieve during dragging a second cube prefab into scene from my Project List. Any suggestions how to make sure Objects are not overlapping in this scenario?

alt text

alt text

Greets -act

bildschirmfoto-2015-07-16-um-135542.png (55.1 kB)
bildschirmfoto-2015-07-16-um-135557.png (54.0 kB)
Comment
Add comment · Show 5
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 everything_appz · Jul 16, 2015 at 05:37 PM 0
Share

Put a box collider on the cube so they can't overlap. As for the snapping you could use $$anonymous$$athf.Round for the positions of the cube so they will always have a whole number as the position. Hope I could help

avatar image actraiser3 · Jul 17, 2015 at 07:13 AM 0
Share

Thanks for the comment. There are box colliders on the cubes, but which don't work while iskinematic is turned on. On the one hand, I need the snapping, on the other hand, I don't want the objects react to physics as this would obviously mess up the level design process.

avatar image everything_appz · Jul 17, 2015 at 07:57 PM 0
Share

Box collider's should work even if the object is$$anonymous$$inematic.

avatar image Vice_Versa · Jul 18, 2015 at 12:01 AM 0
Share

is$$anonymous$$inematic can affect box colliders in certain situations. Anyway, are you dragging them in while the game is running? Thats what it sounds like (I dont have an answer for that) if you mean in Edit $$anonymous$$ode, what you can do is Drag the new prefab onto the previous prefab in the Hierchy (to the point where the name of the old prefab is Completely highlighted) then change the x y and z position values to 0 (it will be the exact same position of the first prefab) then change the value of the y position in the inspector to 1 or 2 or however big the distance is between them). Then, in the Hierchy, drag the second prefab off the first prefab (so that ins$$anonymous$$d of highlighting the name of the prefab it is a blue line with a dot right underneath the name of the first prefab) that way they will appear in the hierchy in the order that you place them.

avatar image actraiser3 · Jul 18, 2015 at 07:03 AM 0
Share

Hi there - yes my Level Editor works in Play()-$$anonymous$$ode. Strange thing is that I believe that the behaviour once was working as intended. Anyways, what came to my $$anonymous$$d and what I try next week is to check collision between a placed object and a dragged object and calculate a appropriate Y-Value offset to be added to the dragged object at time of collision. This may do the trick.

0 Replies

· Add your reply
  • Sort: 

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Export objects to a .3DS file at runtime 1 Answer

drag and drop script 1 Answer

Generate Script in Editor Script and GetType() returns null. 3 Answers

What is runtime analogy for Editor's PrefabUtility.SetPropertyModifications? 0 Answers

Create an array of Vector3 from Editor script 1 Answer


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