AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Unity ai with scriptable objects1/13/2024 ![]() ![]() Let me know what you guys think, am I being dramatic? There's just something I don't like about having to rely on monobehaviors and import settings. The animation events can easily be lost when editing the import settings, this will cause problems 1 and 2 to repeatĪ scriptable object could have a description of the event, the key required, and the target model that it was created for. Scriptable objects are always present, the only reference that is required is to a gameobject that processes the event.Īfter some time, the designer finds out that the new animations are dense in keyframes, he begins editing the import settings on the animation. Scriptable Objects are a class of Unity objects that are very useful in game development. The designer hits play and is greeted with a note from one of the developers "The scriptable object (name) caught the event but was not able to execute it because a reference game object has not been set" because he forgot to apply the monobehaviour scripts The designer hits play and is greeted with a bunch of error messages, one for each event that is not caught. ![]() The designer decides to change the character model to match the new animation, The artists looks for WalkingSFX and references the key value. In the project folder we have a list of scriptable objects that are named corresponding to the event they catch. The animation event targeted a scriptable object. The events are deleted and the artist doesn't remember what was the string for the footstep animations, he has to refer to the monobehaviour script. An artist on the team is experimenting with new animations, they decide to replace the animation with a new one. I want the character to have footstep sounds. Here is a simple use case, I have a demo walking animation that I'm using as part of the development cycle. I posted an idea on the unity feedback page to encourage developing this feature. If something it would need to be a field like public class enemy1:MonoBehaviourĭebug.Log(data.HP + " " data.mana + " " + data.Currently Unity doesn't support targeting a scriptable object as the receiver for animation events. You can only derive from one class so either MonoBehaviour or enemyData! Your last example public class enemy1:MonoBehaviour, enemydata Most Unity configurations are based on ScriptableObject e.g. You cannot compare them, they’re doing different things. It’s primary use is to serialize values to disk, usually large amounts, or complex structures. How to pass data between scenes in Unity) A scriptable Object is nothing like that. This makes ScriptableObjects quite powerful and they have a lot of usecases. Pluggable AI with Scriptable Objects RemDust Joined: Posts: 409 Hi guys, I've been thinking about the best way to implement my next AI system. Get the Finite State Machine Scriptable Object package from Overtime Studios and speed up your game development process. This is a huge advantage against the basic public class EnemyData for which you would already in code have to define which type to use exactly. A bit like an interface but you can exchange the actual method implementation without having to recompile so it can even happen on runtime. You can have a base class and inherit different types of ScriptableObjects and still reference them via the Inspector settings without having to recompile your code You can have multiple instances but with different values => easily exchange e.g. Reference it at multiple places (re-use it) The approach uses scriptable objects and is designed to allow game designers to create multiple variations of an ability and swap between them easily. ![]() ![]() I know I am missing something so please correct me.Thanks!īUT ScriptableObjects are Assets and therefore you can If I have three enemies A, B, C i will just create 3 instances of enemy_data in my project assets, and complete HP, mana,damage individually.On each of my enemy monobehaviour i'll say : public enemydata data Īnd I'll drag the instances from project assets in their inspector.This is what I understood about scriptable objects from the tutorials I have seen.But, what if i did this: public class enemydataĪnd just inherit this class?Wouldn't this be the same thing? public class enemy1:MonoBehaviour, enemydataĭebug.Log(this.HP + " " this.mana + " " + this.damage) I created three Scriptable Objects for my Unity word game: FeemData - This is to hold information on letters NeemData - This is to hold information on pronunciation SuperNeemData - This is to hold 1 and 2 together in a single Scriptable Object. Public class enemydata : ScriptableObject Yesterday I've found out about Scriptable Objects in Unity.The first thing that came to my mind is : hey, this is really simillar to inheritance.Let's say I have this: ![]()
0 Comments
Read More
Leave a Reply. |