Hi all,..
I am making a small galaxy of stars. I use a Space Graphics Toolkit to create one. The toolkit script only spawns sprites, not actual gameobjects. Luckily there is the option to make an editable copy of the script. I then place a "star" = prefab gameobject at each sprite-position. I am using this script to do it:
using UnityEngine;
using System.Collections;
public class Star : MonoBehaviour {
public Transform probe;
// Use this for initialization
void Start () {
foreach (var star in GetComponent<SgtCustomStarfield>().Stars) {
Instantiate (probe, star.Position, Quaternion.identity);
}
}
// Update is called once per frame
void Update () {
}
}
It works like a charm. One star is instantiated at each position... My problem is now that I want them to be individual / discernible in some way. Either I need them to have unique names or I need them to have a unique variable as identifier to be able to call them later. Right now they are all just named Star(Clone), all identical.
I am no coder
I do everything with playmaker and I usually get along but I cannot figure out wher to go now. I tried asking for help in Unity forum. Got some help but I cannot figure out how to get it put together into working code
Would a kind soul help me to either:
- Show me a way to do the above but with unique names or identifier variables for each star - then I can continue from there with playmaker as I usually do (my prefab has Playmaker FSMs and is thereby "born with some functionality")
- Or show me a way to do the above inside Playmaker
Thx in advance
Jesper, Denmark