Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

help with ScriptableObject

Discussion in 'Scripting' started by DragonLords_, Jun 20, 2021.

  1. DragonLords_

    DragonLords_

    Joined:
    Sep 16, 2020
    Posts:
    2
    I'm creating a game where there will be multiple instance of the same enemy and I thought of using Scriptable Object, but my problem is since all the enemies of the same type have the same SO and so when 1 enemy die, everyone do. Is it a way I could create an Instance of the Scriptable Object on play, or should i thought using a different method?
     
  2. https://docs.unity3d.com/ScriptReference/ScriptableObject.CreateInstance.html
    Depends on what you would like to use the SOs for. If it's simple data like actual health or actual values in general, then you may be better off with MonoBehaviour. If you want to build an event system with these, you may be better off with SOs, it depends.
     
    Ryiah likes this.
  3. DragonLords_

    DragonLords_

    Joined:
    Sep 16, 2020
    Posts:
    2
    oh ok i see, thank you very much, appreciate the information, I'll look for the CreateInstance. But to explain, I'm using SO to store Health, Defense and attack of the enemy