unity UI - Carousel menu
I'm trying to make the center button to appear larger than the other buttons in menu selection using unity.
This is how I am spawning the buttons
`
for (int i = 0; i < noOfOptions; i++)
{
float j = Mathf.Ceil(noOfOptions / 2);
GameObject newButton =GameObject.Instantiate(buttonToSpawn,this.transform);
newButton.name = i.ToString() + "Button";
newButton.GetComponent<RectTransform>().anchoredPosition3D = startvector * distanceFromOrigin;
newButton.GetComponent<RectTransform>().localScale = new Vector3(2, 2, 2);
newButton.GetComponent<RectTransform>().localScale = new Vector3(2, 2, 2);
newButton.GetComponent<LookAtTest>().index = i;
//transform.eulerAngles = new Vector3(0, 0, 45);
GameObject ChildGameObject1 = buttonToSpawn.transform.GetChild(0).gameObject;
ChildGameObject1.GetComponent<Image>().sprite = sprites[i];
startvector = (Quaternion.Euler(0, angleOfDifference, 0) * (startvector)).normalized;
}
And rotating them in a circular menu :
public void RotateScroller()
{
print("Rotate");
transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, slerpTime * Time.deltaTime);
if (Mathf.Abs(transform.rotation.eulerAngles.y - targetRotation.eulerAngles.y) < 0.1f)
canRotate = false;
}
`
How can I make the center button appear larger than the rest of the buttons?
c# user-interface unity3d menu carousel
add a comment |
I'm trying to make the center button to appear larger than the other buttons in menu selection using unity.
This is how I am spawning the buttons
`
for (int i = 0; i < noOfOptions; i++)
{
float j = Mathf.Ceil(noOfOptions / 2);
GameObject newButton =GameObject.Instantiate(buttonToSpawn,this.transform);
newButton.name = i.ToString() + "Button";
newButton.GetComponent<RectTransform>().anchoredPosition3D = startvector * distanceFromOrigin;
newButton.GetComponent<RectTransform>().localScale = new Vector3(2, 2, 2);
newButton.GetComponent<RectTransform>().localScale = new Vector3(2, 2, 2);
newButton.GetComponent<LookAtTest>().index = i;
//transform.eulerAngles = new Vector3(0, 0, 45);
GameObject ChildGameObject1 = buttonToSpawn.transform.GetChild(0).gameObject;
ChildGameObject1.GetComponent<Image>().sprite = sprites[i];
startvector = (Quaternion.Euler(0, angleOfDifference, 0) * (startvector)).normalized;
}
And rotating them in a circular menu :
public void RotateScroller()
{
print("Rotate");
transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, slerpTime * Time.deltaTime);
if (Mathf.Abs(transform.rotation.eulerAngles.y - targetRotation.eulerAngles.y) < 0.1f)
canRotate = false;
}
`
How can I make the center button appear larger than the rest of the buttons?
c# user-interface unity3d menu carousel
add a comment |
I'm trying to make the center button to appear larger than the other buttons in menu selection using unity.
This is how I am spawning the buttons
`
for (int i = 0; i < noOfOptions; i++)
{
float j = Mathf.Ceil(noOfOptions / 2);
GameObject newButton =GameObject.Instantiate(buttonToSpawn,this.transform);
newButton.name = i.ToString() + "Button";
newButton.GetComponent<RectTransform>().anchoredPosition3D = startvector * distanceFromOrigin;
newButton.GetComponent<RectTransform>().localScale = new Vector3(2, 2, 2);
newButton.GetComponent<RectTransform>().localScale = new Vector3(2, 2, 2);
newButton.GetComponent<LookAtTest>().index = i;
//transform.eulerAngles = new Vector3(0, 0, 45);
GameObject ChildGameObject1 = buttonToSpawn.transform.GetChild(0).gameObject;
ChildGameObject1.GetComponent<Image>().sprite = sprites[i];
startvector = (Quaternion.Euler(0, angleOfDifference, 0) * (startvector)).normalized;
}
And rotating them in a circular menu :
public void RotateScroller()
{
print("Rotate");
transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, slerpTime * Time.deltaTime);
if (Mathf.Abs(transform.rotation.eulerAngles.y - targetRotation.eulerAngles.y) < 0.1f)
canRotate = false;
}
`
How can I make the center button appear larger than the rest of the buttons?
c# user-interface unity3d menu carousel
I'm trying to make the center button to appear larger than the other buttons in menu selection using unity.
This is how I am spawning the buttons
`
for (int i = 0; i < noOfOptions; i++)
{
float j = Mathf.Ceil(noOfOptions / 2);
GameObject newButton =GameObject.Instantiate(buttonToSpawn,this.transform);
newButton.name = i.ToString() + "Button";
newButton.GetComponent<RectTransform>().anchoredPosition3D = startvector * distanceFromOrigin;
newButton.GetComponent<RectTransform>().localScale = new Vector3(2, 2, 2);
newButton.GetComponent<RectTransform>().localScale = new Vector3(2, 2, 2);
newButton.GetComponent<LookAtTest>().index = i;
//transform.eulerAngles = new Vector3(0, 0, 45);
GameObject ChildGameObject1 = buttonToSpawn.transform.GetChild(0).gameObject;
ChildGameObject1.GetComponent<Image>().sprite = sprites[i];
startvector = (Quaternion.Euler(0, angleOfDifference, 0) * (startvector)).normalized;
}
And rotating them in a circular menu :
public void RotateScroller()
{
print("Rotate");
transform.rotation = Quaternion.Slerp(transform.rotation, targetRotation, slerpTime * Time.deltaTime);
if (Mathf.Abs(transform.rotation.eulerAngles.y - targetRotation.eulerAngles.y) < 0.1f)
canRotate = false;
}
`
How can I make the center button appear larger than the rest of the buttons?
c# user-interface unity3d menu carousel
c# user-interface unity3d menu carousel
edited Nov 22 '18 at 11:13
Ignacio Alorre
3,07042850
3,07042850
asked Nov 22 '18 at 10:26


lil misslil miss
63
63
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Try to use Group Layout (Vertical or Horizontal)
You can add "Content Size Fitter" to group and change size (or scale, but size is better) of center button
Also you can use scroll view for scrolling and calculate size of buttons with distance from button's position to center of scroll view
But Iam using Quaternion.Slerp and the menu is infinite, so any button that comes in the center should be of a larger size compared to other.Please help me with any links and or tutorials , since Iam new to UI.
– lil miss
Nov 22 '18 at 19:09
Can you know how many buttons between one button and center? You can calculate size with this information like scale = maxScale / max(1, amount_from_center)
– JammiK
Nov 23 '18 at 12:57
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53428826%2funity-ui-carousel-menu%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try to use Group Layout (Vertical or Horizontal)
You can add "Content Size Fitter" to group and change size (or scale, but size is better) of center button
Also you can use scroll view for scrolling and calculate size of buttons with distance from button's position to center of scroll view
But Iam using Quaternion.Slerp and the menu is infinite, so any button that comes in the center should be of a larger size compared to other.Please help me with any links and or tutorials , since Iam new to UI.
– lil miss
Nov 22 '18 at 19:09
Can you know how many buttons between one button and center? You can calculate size with this information like scale = maxScale / max(1, amount_from_center)
– JammiK
Nov 23 '18 at 12:57
add a comment |
Try to use Group Layout (Vertical or Horizontal)
You can add "Content Size Fitter" to group and change size (or scale, but size is better) of center button
Also you can use scroll view for scrolling and calculate size of buttons with distance from button's position to center of scroll view
But Iam using Quaternion.Slerp and the menu is infinite, so any button that comes in the center should be of a larger size compared to other.Please help me with any links and or tutorials , since Iam new to UI.
– lil miss
Nov 22 '18 at 19:09
Can you know how many buttons between one button and center? You can calculate size with this information like scale = maxScale / max(1, amount_from_center)
– JammiK
Nov 23 '18 at 12:57
add a comment |
Try to use Group Layout (Vertical or Horizontal)
You can add "Content Size Fitter" to group and change size (or scale, but size is better) of center button
Also you can use scroll view for scrolling and calculate size of buttons with distance from button's position to center of scroll view
Try to use Group Layout (Vertical or Horizontal)
You can add "Content Size Fitter" to group and change size (or scale, but size is better) of center button
Also you can use scroll view for scrolling and calculate size of buttons with distance from button's position to center of scroll view
answered Nov 22 '18 at 11:44
JammiKJammiK
1
1
But Iam using Quaternion.Slerp and the menu is infinite, so any button that comes in the center should be of a larger size compared to other.Please help me with any links and or tutorials , since Iam new to UI.
– lil miss
Nov 22 '18 at 19:09
Can you know how many buttons between one button and center? You can calculate size with this information like scale = maxScale / max(1, amount_from_center)
– JammiK
Nov 23 '18 at 12:57
add a comment |
But Iam using Quaternion.Slerp and the menu is infinite, so any button that comes in the center should be of a larger size compared to other.Please help me with any links and or tutorials , since Iam new to UI.
– lil miss
Nov 22 '18 at 19:09
Can you know how many buttons between one button and center? You can calculate size with this information like scale = maxScale / max(1, amount_from_center)
– JammiK
Nov 23 '18 at 12:57
But Iam using Quaternion.Slerp and the menu is infinite, so any button that comes in the center should be of a larger size compared to other.Please help me with any links and or tutorials , since Iam new to UI.
– lil miss
Nov 22 '18 at 19:09
But Iam using Quaternion.Slerp and the menu is infinite, so any button that comes in the center should be of a larger size compared to other.Please help me with any links and or tutorials , since Iam new to UI.
– lil miss
Nov 22 '18 at 19:09
Can you know how many buttons between one button and center? You can calculate size with this information like scale = maxScale / max(1, amount_from_center)
– JammiK
Nov 23 '18 at 12:57
Can you know how many buttons between one button and center? You can calculate size with this information like scale = maxScale / max(1, amount_from_center)
– JammiK
Nov 23 '18 at 12:57
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53428826%2funity-ui-carousel-menu%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown