Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 nhimmisha · May 04, 2015 at 10:09 AM · guicanvasunity 4.6

Can I put non-GUI objects into Canvas?

Hi,

I'm creating a 2D jigsaw puzzle game using GUI 4.6. I want to place GUI and non-GUI objects into one Canvas. Non-GUI objects may contain box collider, rigidbody, sprite/mesh render, animations etc.

Is it normal to do so?

Comment
Add comment · Show 2
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 Nerevar · May 04, 2015 at 10:49 AM 0
Share

If it is logic/convenient in you project to have some objects child of your canvas,I guess it is ok to do so. Be aware you might have some unexpected behaviors with the colliders if they overlap with other UI-elements. $$anonymous$$aybe if you explain a bit more your situation, the community could come with better solutions.

avatar image nhimmisha · May 04, 2015 at 11:43 AM 0
Share

Can you build a 2D game by just using GUI elements? $$anonymous$$y game may not require collision. I think if I put all my objects into Canvas, it's easier to manage and better for scaling. I've just started so I don't have much things to explain.

1 Reply

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

Answer by DiegoSLTS · May 04, 2015 at 01:17 PM

You can add non-UI objects to a Canvas, but it becomes weird working that way. UI stuff use a Rect Transform, and you can replace the Transform component of an object with a RectTransform, but the values don't make sense any more. A 1x1x1 cube must have a width and height of 1 and then be scaled up, and other anchor options like stretching won't work as expected (they change the width and height, not the scale).

Also, I couldn't add a cube on an Overlay canvas, only in World or Camera space.

You can make a whole game using UI stuff if you're OK with 2D elements. Your jigsaw pieces can be just Image components with a sprite for each piece and you can drag and drop UI stuff with pointer and drag events.

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 nhimmisha · May 05, 2015 at 02:48 AM 0
Share

Weird but acceptable. Thanks. I also want to make a book app this way. Sounds easy with Image components.

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

2 People are following this question.

avatar image avatar image

Related Questions

Canvas Scaler appears to crash my game. 0 Answers

Use Unity UI For 2D Games Or Custom Objects Instead? 2 Answers

How to add sprites to a canvas via scripting 1 Answer

Canvas Scaler - scaleFactor 0 Answers

What's the most practical way to show particles on a "Screen Space - Overlay" Canvas with the new GUI (uGUI, Unity 4.6+)? 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