Just wondering if anybody knew of a good way to create objects in editor mode for an editor script I’m working on.
Its a tile system which works in layers, allows stacking of tiles.
I am creating a new GameObject every time the user clicks on a specific area on the screen, which works fine as it is only one object at a time.
The problem is when i’m creating a bunch of game objects at the same time, for example duplicating a layer uses Instantiate with a parameter of the game object i’m looking to duplicate, which should take a bit more processing power but i’m trying to thinks of ways to speed it up especially on low end PCs.
Are there any techniques to use to speed up object creation in editor mode, to give a better user experience, same questions goes for deleting objects in editor mode as well ?
None of my objects are serialized as I do not know the difference between doing that or just referencing the game object.
I just noticed that it may be my processing power on my computer, and that is why some things are running slow.
However I was wondering if it was possible to load objects in segments, just like how they are loaded in games.
If i was to have 10 objects to instantiate at the same time on the screen, can I split that into smaller chunks to load. For example load the first 2, and then move on to the next until the loading is complete, at least this way you can tell whether or not the tool is actually loading objects.
The question I have is after you write a function like so :
GameObject object = Instantiate(gameobject);
Debug.Log(“Game Object Loaded”);
will the debug function only appear, after the object has loaded, or is the object loaded asynchronously ?
I would like to say (based on my knowledge of threads and such) that the debug log will be called once the object is instantiated, but I couldn’t say for absolute certain without testing.
An easy way to test is to use the pause and step buttons in the editor. Set your function off, pause the editor, then step through frame-by-frame :).
If you are relying on things happening in a certain order, I would recommend using co-routines
Thanks for the reply, I actually forgot about co-routines, because i’ve been mainly trying to learn as much as I can on editor programming.
I’m mainly trying to come up with a system which loads a certain amount of objects and then moves on the next batch, rather than load objects all at once.
I will have a look into co-routines and see if i can use that to come up with a way to do it.
If anyone has any ideas of how to achieve something like this any help would be great!