Questions tagged [scriptable-object]

106 questions
0
votes
1 answer

Unexpected increase in List.Count after adding elements to the list

After running the following loop (one iteration), battleshipParts.Count returns 2. The code is ran once in the ScriptableObject.Awake for (byte i = 0; i < 1; i++) { var battleshipPart = CreateInstance(); …
Phillip Zoghbi
  • 512
  • 3
  • 15
0
votes
0 answers

Can't Find Children After Drag and Drop to New Parent in Unity

I am able to move a transform with scriptable object "note" to a new parent "note slot" and have it appear as a child in the editor, but I can't find it using code. It says there are no children. After dropping the note using IDropHandler, I try to…
0
votes
1 answer

Why does my Scriptable Object lose all its data after the second assembly reload?

So i'm writing spell system with using some kind of spell component system. Spells itself and spell components are Scriptable Objects. Spell to create as asset and SpellComponent because non unity objects can't be properly serialized with…
0
votes
0 answers

ObjectReferenceValue not updating in CustomPropertyDrawer

i am trying to create a custom property drawer that lets me open and edit properties of a scriptable object however i want it to be done so that if i create a new scriptable object this way (only in memory and not on disk) then it should create a…
0
votes
0 answers

How can I Unit Test PlayMode behaviours with a Scriptable Object Channel based setup for my Unity game?

I'm writing a card game in Unity and have a setup where all my MonoBehaviour objects communicate through SO channels. For example, GraphicsEngine <= GameManager <=> AI I would like to write some PlayMode unit tests that, for example, set all of the…
0
votes
1 answer

Using Scriptable Objects as Polymorphic Serialization

My scene has a list of individual Module. Those modules can have different data associated with them and also different logic, so I decided to create several derived classes from Module and store them in a list. By making Module inherit from…
Icaro Amorim
  • 385
  • 1
  • 3
  • 13
0
votes
1 answer

How can I see and edit the fields of the scriptable object in the inspector of the same script where I set reference to it?

After creating an asset object in the assets folder of a scriptable object class, we can see and edit the values of the fields of that scriptable object. Then we can reference that object in different scripts and read/write its values. So, I…
0
votes
0 answers

Serialize List with ScriptableObject with inheritance in CustomEditor [Unity C#]

I'm trying to build a custom editor for a ScriptableObject. Everything works fine with standard properties (string, enum) But I'm trying to also add a List/Array, which contains items that all inherit from one blueprint class based on…
0
votes
0 answers

How can I replace the method being subscribed to in this line of code with a string variable?

I'm trying to assign player inputs for new spells unlocked by a player, I'm using Unity's Input system. When a player selects a spell it subscribes the relevant binding to the spell's cast method (e.g. 'CastFireball()') I want to replace the manual…
0
votes
1 answer

Complex data structures with ScriptableObjects in Unity3D

I am trying to create a data structure like in the picture, where I can easily add and remove the reward type. It is for a roguelike level-up system where basically I want to get a reward for a specific character like a warrior or mage from a…
mAts
  • 3
  • 2
0
votes
3 answers

How to change the contents of a ScriptableObject after building a project?

I want to change a value in a ScriptableObject after building in Unity. However, it worked fine before the build, but the SO value did not change in the exe file after the build. However, the list of other SOs is accessible. You can't change exactly…
맹주영
  • 1
  • 1
0
votes
1 answer

Do scriptable objects work on Android devices

I have created a simple scriptable object with a list, 1 button and something to the list, second load its into the text ui. When I test this on Unity, it works when I already build the app from the build settings, android on the other hand doesnt.…
Jack Hunt
  • 17
  • 3
0
votes
0 answers

ScriptableObject doesn't save list of System.Object types

public class GameData : ScriptableObject { public List groups = new List(); public List prefabs = new List(); public List thematics = new List(); …
NN NN
  • 1
0
votes
0 answers

Is there a better way to associate Variables with an Enum than an Array?

Context I am using a Unity ScriptableObject to define basic Enemy Stats So I have an Enum for special damage types but some enemies might have resistances like Fire Elemental might obviously take no Fire Damage So what I originally thought of was…
0
votes
2 answers

Updating Field/ variable acting differently in the code and UNITY

I am having trouble to update my field/variable properly. Simply my problem is: when I call AddCoins(); method, I can see on Unity that coins are increasing on the scene. However for some reason CheckPurchaseable(); can not detect the updated value…
user19059534