added 22 characters in body
Source Link
Pheonix2105
  • 534
  • 5
  • 16
  1. I don't understand how a canvas makes sense when I want to display non-UI game elements that contain text, such as damage counters or, as in the case of the game I started working on, playing cards.
  1. I don't understand how a canvas makes sense when I want to display non-UI game elements that contain text, such as damage counters or, as in the case of the game I started working on, playing cards.

A: All these things are graphical user interface design elements, so by definition they belong on the presentation layer, in this case a Canvas! Even if your cards exists physically in the scene, the best way to display icons, text etc everything you need for a card based game will be mostly done on canvases.

2: If I understand it correctly, I would not only need a canvas to place my cards on (preferably separate from the one that contains my UI elements) but if I want to put text on my cards and make them come from a reusable Prefab, the Prefab itself needs to be a canvas (or somehow contain one), otherwise text elements would not show up on it (at least based on my trials).

2: If I understand it correctly, I would not only need a canvas to place my cards on (preferably separate from the one that contains my UI elements) but if I want to put text on my cards and make them come from a reusable Prefab, the Prefab itself needs to be a canvas (or somehow contain one), otherwise text elements would not show up on it (at least based on my trials).

You can also use TextMeshPro Unity Package which has a Component TextMeshPro (not TextMeshProUGUI) which can be used to display text in world space without a canvas.

A: Incorrect, if the object you are spawning is going to be placed onto a canvas, then the object itself doesn't need its own canvas, in fact due to how Unity Canvases update I would think it would be even worse than giving every single item its own canvas, since a canvas only updates when something changes, but if something changes the ENTIRE canvas is refreshed and if you have a canvas within a canvas, it will be checking two canvases each time one of them changes.

I would have thought having all cards on their own canvas, then the dynamic UI on one canvas and static on another would be a good starting point, but really I wouldn't prematurely optimize this.

As to a tutorial there are actually plenty around, though I usually don't like linking Youtube tutorials on GameDevSE https://www.youtube.com/watch?v=aPXvoWVabPY by Brackeys would help you best, this covers using ScriptableObjects as Data containers for cards, it shows you how to set up a prefab, which along with the ScriptableObject data container can display any card you have, it generally explains the concept of using ScriptableObject as data containers for cards well without eating up too much time.

Hope some of this helps!

  1. I don't understand how a canvas makes sense when I want to display non-UI game elements that contain text, such as damage counters or, as in the case of the game I started working on, playing cards.

A: All these things are graphical user interface design elements, so by definition they belong on the presentation layer, in this case a Canvas! Even if your cards exists physically in the scene, the best way to display icons, text etc everything you need for a card based game will be mostly done on canvases.

2: If I understand it correctly, I would not only need a canvas to place my cards on (preferably separate from the one that contains my UI elements) but if I want to put text on my cards and make them come from a reusable Prefab, the Prefab itself needs to be a canvas (or somehow contain one), otherwise text elements would not show up on it (at least based on my trials).

You can also use TextMeshPro Unity Package which has a Component TextMeshPro (not TextMeshProUGUI) which can be used to display text in world space without a canvas.

A: Incorrect, if the object you are spawning is going to be placed onto a canvas, then the object itself doesn't need its own canvas, in fact due to how Unity Canvases update I would think it would be even worse than giving every single item its own canvas, since a canvas only updates when something changes, but if something changes the ENTIRE canvas is refreshed and if you have a canvas within a canvas, it will be checking two canvases each time one of them changes.

I would have thought having all cards on their own canvas, then the dynamic UI on one canvas and static on another would be a good starting point, but really I wouldn't prematurely optimize this.

As to a tutorial there are actually plenty around, though I usually don't like linking Youtube tutorials on GameDevSE https://www.youtube.com/watch?v=aPXvoWVabPY by Brackeys would help you best, this covers using ScriptableObjects as Data containers for cards, it shows you how to set up a prefab, which along with the ScriptableObject data container can display any card you have, it generally explains the concept of using ScriptableObject as data containers for cards well without eating up too much time.

Hope some of this helps!

  1. I don't understand how a canvas makes sense when I want to display non-UI game elements that contain text, such as damage counters or, as in the case of the game I started working on, playing cards.

A: All these things are graphical user interface design elements, so by definition they belong on the presentation layer, in this case a Canvas! Even if your cards exists physically in the scene, the best way to display icons, text etc everything you need for a card based game will be mostly done on canvases.

2: If I understand it correctly, I would not only need a canvas to place my cards on (preferably separate from the one that contains my UI elements) but if I want to put text on my cards and make them come from a reusable Prefab, the Prefab itself needs to be a canvas (or somehow contain one), otherwise text elements would not show up on it (at least based on my trials).

You can also use TextMeshPro Unity Package which has a Component TextMeshPro (not TextMeshProUGUI) which can be used to display text in world space without a canvas.

A: Incorrect, if the object you are spawning is going to be placed onto a canvas, then the object itself doesn't need its own canvas, in fact due to how Unity Canvases update I would think it would be even worse than giving every single item its own canvas, since a canvas only updates when something changes, but if something changes the ENTIRE canvas is refreshed and if you have a canvas within a canvas, it will be checking two canvases each time one of them changes.

I would have thought having all cards on their own canvas, then the dynamic UI on one canvas and static on another would be a good starting point, but really I wouldn't prematurely optimize this.

As to a tutorial there are actually plenty around, though I usually don't like linking Youtube tutorials on GameDevSE https://www.youtube.com/watch?v=aPXvoWVabPY by Brackeys would help you best, this covers using ScriptableObjects as Data containers for cards, it shows you how to set up a prefab, which along with the ScriptableObject data container can display any card you have, it generally explains the concept of using ScriptableObject as data containers for cards well without eating up too much time.

Hope some of this helps!

Source Link
Pheonix2105
  • 534
  • 5
  • 16

  1. I don't understand how a canvas makes sense when I want to display non-UI game elements that contain text, such as damage counters or, as in the case of the game I started working on, playing cards.

A: All these things are graphical user interface design elements, so by definition they belong on the presentation layer, in this case a Canvas! Even if your cards exists physically in the scene, the best way to display icons, text etc everything you need for a card based game will be mostly done on canvases.

2: If I understand it correctly, I would not only need a canvas to place my cards on (preferably separate from the one that contains my UI elements) but if I want to put text on my cards and make them come from a reusable Prefab, the Prefab itself needs to be a canvas (or somehow contain one), otherwise text elements would not show up on it (at least based on my trials).

You can also use TextMeshPro Unity Package which has a Component TextMeshPro (not TextMeshProUGUI) which can be used to display text in world space without a canvas.

A: Incorrect, if the object you are spawning is going to be placed onto a canvas, then the object itself doesn't need its own canvas, in fact due to how Unity Canvases update I would think it would be even worse than giving every single item its own canvas, since a canvas only updates when something changes, but if something changes the ENTIRE canvas is refreshed and if you have a canvas within a canvas, it will be checking two canvases each time one of them changes.

I would have thought having all cards on their own canvas, then the dynamic UI on one canvas and static on another would be a good starting point, but really I wouldn't prematurely optimize this.

As to a tutorial there are actually plenty around, though I usually don't like linking Youtube tutorials on GameDevSE https://www.youtube.com/watch?v=aPXvoWVabPY by Brackeys would help you best, this covers using ScriptableObjects as Data containers for cards, it shows you how to set up a prefab, which along with the ScriptableObject data container can display any card you have, it generally explains the concept of using ScriptableObject as data containers for cards well without eating up too much time.

Hope some of this helps!