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 MrAkroMenToS · Aug 29, 2014 at 10:01 AM · c#ui4.6

Unity 4.6 Error different layout!

EDIT: I saw the question is not exact! I get a different layout when building my game and different layout when starting in the editor!

This is when i BUILD the project: alt text This is when i start in the Game preview: alt text I add the elements through code, i have prefabs for it. My code:

         loginForm = Resources.Load<GameObject>("UI/loginForm");
         EventHelper = Resources.Load<GameObject>("UI/UI_base/EventSystem");
         UIHelper = Resources.Load<GameObject>("UI/UI_base/UIHandler");
         
         GameObject.Instantiate(EventHelper, new Vector3(0, 0, 0), Quaternion.identity);
         GameObject UIObj = (GameObject)GameObject.Instantiate(UIHelper, UIHelper.transform.position, UIHelper.transform.rotation);
         GameObject loginObj = (GameObject)GameObject.Instantiate(loginForm, loginForm.transform.position, loginForm.transform.rotation);
         loginObj.transform.SetParent(UIObj.transform, false);

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Joseph123123 · Aug 29, 2014 at 11:56 AM

I have been testing the 4.6 UI and to make this work, click your button in the scene, then scroll all the way down in the inspector. From there, you should see a onclick tab in the inspector on the bottom. Then click the plus, drag and drop a empty gameobject into the onclick tab, then drag the script into the empty gameobject. Then make a function called Instantiateobject. Then put the instantiated code in there. Remove everything but the Instantiated object.Save the code, then in the Onclick tab for the button, click the thing that says function. From there, select the script in the drop down, then click the instantiatedobject. That means when you click the button, it will instantiate the object. Then, you can add another gameobject in the onclick tab and you can drag one of the ui's in it and click functions, select the gameobject name, and click SetActive(bool) and checkmark the button next to the functions button, and disable yhe UI to have in the SetActive in the OnClock. That means when you click it, it will activate the button.

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 MrAkroMenToS · Aug 29, 2014 at 02:31 PM 0
Share

This isn't quite the answer for my question. Read once more my question please. It says i get a different layout when building my game and different layout when starting in the editor!

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

23 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

Related Questions

[4.6] Toggle/Checkbox On/Off 1 Answer

[C#] How to code within the Unity 4.6 new UI Panels? 0 Answers

[4.6 - UI] Calling function on button click via script 1 Answer

Distribute terrain in zones 3 Answers

How to make a single word in a Text object clickable / have hover. 2 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