I made a Unity Prefab where about 5 things vary. I then made an invisible GameObject where I use Visual Scripting to hardwire the 5 differing items, in order to create the various GameObjects I need.
It is hardwired, but the Prefab is working really well for my purposes. Here's a sample part of that script, where I'm setting the color of some text and also the sprite.
I'd like to make the whole thing less hardwired, and to keep track of these 5 things in a database of sorts. So I defined a Scriptable Object with the 5 variables in it:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(fileName = "New NeemData", menuName = "Neem Data", order = 51)]
public class NeemData : ScriptableObject
{
[SerializeField]
private string neemName;
[SerializeField]
private Vector3 neemPosition;
[SerializeField]
private Sprite singleNeemSprite;
[SerializeField]
private string feemText;
[SerializeField]
private Color feemColor;
}
I've been able to easily create Scriptable Objects with data in it, like this one:
I'd like to be able to populate my Prefab with the data from that Scriptable Object, and create GameObjects with that workflow. But I'm not sure the best way to get data out of a Scriptable Object, and combined with a Prefab template to make GameObjects. Any advice?
private NeemData myDataHolder
. For code references, please use the code markup instead of screenshots \$\endgroup\$