- Home /
How to create asset-store-like assets?
With Unity very often you will get to a problem for which the only solution is "download this asset, download that asset". But to make such an asset work somebody has to have found a solution first, right? So how to code something that seems impossible? How do asset publishers create assets? Do they even use c# Scripts at all or do they dig in way deeper? And if so how to do so?
Examples:
All Forum related solutions are not compareable to this one.
Unitys ProBuilder
Changing the pivot of a gameobject in Unity is not possible. You would have to go to blender and remodel the object in order to do so. This asset simply lets objects have their pivot changed to their center of mass, or even to a custom location (using FreezeTransform).
Answer by Eno-Khaon · Feb 08 at 10:56 PM
One of the first rules of programming is that (almost) anything is *POSSIBLE*, but they may require more or less effort depending on implementation and presentation. It frequently takes a lot of extra work simply to ensure the script(s) won't choke when given incompatible data (as a basic example, including a check for, rather than dividing by zero and throwing an error).
Likewise, one of the submission requirements for the Asset Store is that you can't even submit something that's *TOO* simple; it can't just be something that anyone could whip together in a few minutes. So content on the Asset Store should be *expected* to have had meaningful work put into it.
With the way Unity is built, virtually anything can be handled through C# scripts, but there can also be times when a better optimized/speedier external call might become a more viable option. As a "simple" example of a direct behavior comparison, cycling through an array in a simple C++ program would take less time than doing the same in C# due to differences in the way the languages are compiled and how each handles their data, as well as additional safeties C# compilations tend to automatically implement to handle/prevent crashes if array indices go out of bounds. C++ would potentially let you read data outside of the array's actual data if not used properly, whereas C# would not allow that to occur as easily, resulting in more overhead in keeping the entire process of reading from the array in check.
At a glance, the Runtime Transform Gizmos you linked looks like it could be a combination of GL.Lines() (or similar), possibly Graphics.DrawMesh() to draw pre-made cone meshes for the caps on each Transform Handle... I'm not as sure about the circles around each object (for rotation), since too many GL.Lines() calls could get slow...
Then, put a Sphere Collider around the whole thing to listen for Raycasts and pass them through based on relative position, so there's only a single Collider per set of handles.
Is that exactly how they implemented it? Probably not. What I described also assumes it's entirely in 3D space and isn't rendered as a UI element, which makes a difference if render resolution and UI resolution aren't the same.
No matter how it's actually put together, a lot of work has to be put into it to ensure that it behaves consistently in every possible scenario.
In terms of changing the pivot point of a GameObject... in any case, it would involve modifying the mesh and shifting all vertex positions to be relative to a new pivot point. The next step is where it may be more or less complex, since it's the choice between:
Saving a Unity Asset and/or Prefab as a copy of the modified imported mesh
or
Modifying the imported mesh itself, which can come in a variety of file formats with differing data structures, ordering, and compression to store the vertex data.
Either way, Unity ProBuilder does a lot and has (also) been made and worked on over a long period of time, so it's had time to be cleaned up and refined based on usage experience and user feedback as well.
Answer by Barkine94 · Feb 08 at 08:39 PM
These kind of asset packages are created by dedicated developers that are most probably professional. Some of them are even being created by companies. The ones you see in the asset store are the famous and the successful ones. If you want to create some asset you may need to get way deeper to the theoritical background of the topic that you want to publish.
Your answer
Follow this Question
Related Questions
What are the rules for the Plugins folder in Unity 5? 0 Answers
Where Unity Store Package Files in iMac 1 Answer
How to handle Asset Store - Plugins? 1 Answer
Unity plugin for .gif files? 2 Answers