• 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 /
This question was closed Feb 19, 2015 at 04:00 PM by meat5000 for the following reason:

The question is answered, right answer was accepted

avatar image
9
Question by hansadler · Sep 30, 2014 at 05:54 AM · uipanel

What class is a Panel?

I'd like to be able to move a Panel object around inside it's parent Canvas object in script. I'd like to add a public variable to a gameobject so it can manipulate the Panel in script. What type do I use for the panel variable? There are UnityEngine.UI.Button and UnityEngine.UI.Text classes, but there is no UnityEngine.UI.Panel class, so I'm confused.

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

  • Sort: 
avatar image
19
Best Answer

Answer by HellFireKoder · Sep 30, 2014 at 06:29 AM

A Panel does not have it's own class, all the "Panel" Game Object is, is a "Rect Transfrom", a "Canvas Renderer", and a "Image" script, which are classes that are on every uGUI Game Object that I have seen (except the "Image" script, which isn't on a uGUI "Text"), the "Image" script is just the script to actually show the image for the panel., so I think you should use the "Rect Transform" as it holds the position, and maybe a hidden button for dragging it, if it can only be dragged from a certain area anyway, or a custom script that detects mouse down, and mouse drag.

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 Kiwasi · Sep 30, 2014 at 08:44 AM 2
Share

As indicated panels don't exist. When you click create panel Unity simply creates its internal prefab for panel.

This is the same as creating a cube or any of the other built in GameObjects. There is no cube class. The cube is a GameObject with mesh, renderer and collider components attatched.

avatar image
11

Answer by quimmedes · Feb 19, 2015 at 04:12 PM

I was looking for the same thing and I find out that panel it's just used like a simple GameObject.

Comment
Add comment · 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

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Add Text To UI Panel on Button Click 1 Answer

Why are my UI elements hidden behind the background? 3 Answers

What is the code to load a panel that is not a buildIndex scene? 1 Answer

Fading in and out multiple panels 0 Answers

Make panel inactive on second click 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