I made a Unity Prefab the place about 5 issues differ. I then made an invisible GameObject the place I exploit Visible Scripting to hardwire the 5 differing gadgets, so as to create the assorted GameObjects I want.
It’s hardwired, however the Prefab is working rather well for my functions. Here is a pattern a part of that script, the place I am setting the colour of some textual content and in addition the sprite.
I might wish to make the entire thing much less hardwired, and to maintain monitor of those 5 issues in a database of kinds. So I outlined a Scriptable Object with the 5 variables in it:
utilizing System.Collections;
utilizing System.Collections.Generic;
utilizing UnityEngine;
[CreateAssetMenu(fileName = "New NeemData", menuName = "Neem Data", order = 51)]
public class NeemData : ScriptableObject
{
[SerializeField]
personal string neemName;
[SerializeField]
personal Vector3 neemPosition;
[SerializeField]
personal Sprite singleNeemSprite;
[SerializeField]
personal string feemText;
[SerializeField]
personal Colour feemColor;
}
I have been capable of simply create Scriptable Objects with information in it, like this one:
I might like to have the ability to populate my Prefab with the information from that Scriptable Object, and create GameObjects with that workflow. However I am unsure one of the simplest ways to get information out of a Scriptable Object, and mixed with a Prefab template to make GameObjects. Any recommendation?