Answer the question
In order to leave comments, you need to log in
How to hang canvas on scriptableObject?
Hello everyone
I got carried away here with unity, I'm making a small ui for the game. And there was a need to add an item, in which there will be fields:
- title,
- image for it
- description (description in the form of text, and background_image, on which the text will hang).
There is no way to add canvas to a scriptable object (when trying to migrate the canvas prefab, it simply does not migrate). Does anyone know how this is done?
public class Item : ScriptableObject
{
new public string name = "New Item";
public Sprite icon = null;
public Canvas description = null;
}
Answer the question
In order to leave comments, you need to log in
You have bad architecture. ScriptableObject is essentially a static data store, and it should not know anything about the game, much less interact with the UI in any way. You need a separate MonoBehaviour that will impersonate the game object, it will interact with the world and know the properties of the Item.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question