|
Post by enchantsean on Sept 10, 2020 17:06:54 GMT
Hey everyone, Im new to programming and I've chosen this asset to have a really smooth experience on my apps. Couple things I'm trying to figure out on how to approach is First off, I'm working off the animal tutorial scene from the project, nothing added. How can I turn these items into buttons How can I change the font style and size on the list that is made. Basically, how can I edit one gameobject, after giving it the right components, button, font style and size. And Have that created in the scroller. I've tried editing just the game object, then I look deeper into the scripts with the data of all the animal names, then I kinda don't know to approach it. Any help would greatly appreciated
|
|
|
Post by echo17 on Sept 11, 2020 12:12:47 GMT
I replied to your email, but I'll copy here for completeness:
I am having trouble understanding what you are trying to achieve. If you cannot provide an example project, can you send some mockups of what you would like to see? Please include a mockup of each step in the process and what causes the transition between states. You can just create images using an image editor (like GIMP or Photoshop) for the mockups.
|
|
|
Post by enchantsean on Sept 11, 2020 15:19:13 GMT
Well, I didn't think it was that confusing. I'm trying to achieve some very simple things. 1. How do I turn these into buttons? 2. How do I change the Font Style / Size. As you can see in the picture, If I edit the "Item" in the scroller while in play mode, I can change the background image to my invisible.png, I can change the font style, I can change the font color and size. How do I achieve this with this asset? Basically, I don't know how to turn the items in the scroller into buttons, and I don't know how to change the font style and size. Thats all I'm trying to do. I don't feel like I need to send you a sample scene, because all I have is your sample scene. all I did was change the animal names into letters.
|
|
|
Post by echo17 on Sept 12, 2020 9:58:18 GMT
I believe the confusion for me is in that you are asking to change the cell views to buttons. If you want the cellviews from the quickstart tutorial to have buttons, you just need to add a Button component to the cellview prefab.
Also, in Unity you cannot change controls into other controls. If you are just wanting to show a different look for a cellview once it is clicked, then one way to achieve this would be to set up to sub-cellviews that have their visibility toggled depending on which state the cellview is in. Example structure:
CellView |- StateA |- StateB
In your code, when the cellview is clicked, you can use the SetActive method of StateA and StateB to toggle their visibility.
public class CellView { ... // other code
private enum CellState { StateA, StateB }
private CellState _cellState;
public GameObject stateA; public GameObject stateB;
public void OnCellViewClicked() { if (_cellState == CellState.StateA) { _cellState = CellState.StateB; } else { _cellState = CellState.StateA; }
stateA.SetActive(_cellState == CellState.StateA); stateB.SetActive(_cellState == CellState.StateB); }
... // other code }
In your inspector, you'd need to link the gameobjects StateA and StateB to your CellView script's stateA and stateB references. You'd also need to link the cellview's Button script click event to the OnCellViewClicked method of the CellView script.
This method of having multiple states for a cell lets you set up at design time what you'd like your cell to look like in each state. That way you don't have to change fonts or visual styles at runtime, just toggle to the state you would like to see.
|
|
|
Post by enchantsean on Sept 12, 2020 15:29:57 GMT
I tried changing the cell view prefab, nothing takes the changes.
Also Im not trying to change the text/font when clicked. Im trying to change it permanent.
|
|
|
Post by roymunson on Sept 12, 2020 17:35:08 GMT
You have to take the additional step of actually opening the prefab in order to edit it. Select the prefab, then look way up at the top of the inspector. You should see "open" as a selection.
|
|
|
Post by echo17 on Sept 14, 2020 12:36:02 GMT
I tried changing the cell view prefab, nothing takes the changes. Also Im not trying to change the text/font when clicked. Im trying to change it permanent. Ah, I see my confusion now. I thought you were asking about how to use EnhancedScroller, not Unity in general. Fortunately, Unity has a very large following which have created numerous tutorials to help you get started. Here's a few links that you might find relevant: PrefabsUnity UI
|
|
|
Post by enchantsean on Sept 16, 2020 3:05:02 GMT
I tried changing the cell view prefab, nothing takes the changes. Also Im not trying to change the text/font when clicked. Im trying to change it permanent. Ah, I see my confusion now. I thought you were asking about how to use EnhancedScroller, not Unity in general. Fortunately, Unity has a very large following which have created numerous tutorials to help you get started. Here's a few links that you might find relevant: PrefabsUnity UIThanks for the links. Im pretty familiar with Unity, I'm more of a creative designer then a technical programmer. I'm just used to editing the gameobject, always forget to open the prefab for special game objects.
|
|
|
Post by enchantsean on Sept 16, 2020 3:26:28 GMT
You have to take the additional step of actually opening the prefab in order to edit it. Select the prefab, then look way up at the top of the inspector. You should see "open" as a selection. This worked perfectly. Thank you friend.
|
|
|
Post by roymunson on Sept 17, 2020 2:33:55 GMT
enchantsean Well, you're very welcome, friend. Glad it helped.
|
|