I know how to get all objects with a tag and get a script on them but im not sure how I would go about ordering them from greatest to least (in an array of game objects) depending on a variable of initiative each object has? Any ideas?
I have no experiance with Array sorting but I found this website http://www.csharp-examples.net/sort-array/
use Lists. they have a sort function: List<T>.Sort Method (System.Collections.Generic) | Microsoft Learn
include the line:
using System.Collections.Generic;
make a list of components with the property you want to sort by:
(example)
public List<Component> component;
use the sort function
Ok, I looked at that but im not sure. That sorts them on there name but I need to sort them depending on a variable ina script?
Just use any sort algorithm, Bubble sort for example, with your script variable as sort key.
Or pick one here: Sorting. Everyone has code example.