Questions tagged [scriptable-object]
106 questions
1
vote
2 answers
Return a ScriptableObject's original value after quit Playmode in Unity
I have a ScriptableObject like this
and during Playmode I adjust the CurrenHealthValue
and when I exist the Playmode the CurrentHealthValue=80 doesn't return to 40, I know it was how ScriptableObject works but I want to know if there is any way…

Tien Hung
- 139
- 8
1
vote
2 answers
CS0120 Error appears in function despite a parameter being used
I'm making an inventory system with ScriptableObjects. Below is the ScriptableObject code for the save data of a player. Within it contains the Inventory and Wormhole class. Within the Inventory class contains the InventoryMain list, some special…

kale
- 36
- 7
1
vote
1 answer
I can't modify ScriptableObject value. [Unity3D]
So, I have a ScriptableObject which stores the KeyCodes for the player input:
InputController.cs:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(fileName = "InputController", menuName =…

The Riser
- 309
- 2
- 4
- 12
1
vote
1 answer
How to randomize what scriptable object gets loaded
I am a complete noob when it comes to coding in unity . I have a couple of different enemies that are scriptable objects and when I start a battle I would like to load a random one of those enemies. Can anyone please help I cant figure out how to do…

DppStarkiller
- 11
- 1
1
vote
1 answer
ScriptableObject not saving data when entering play mode
I have the following scriptable object:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
[CreateAssetMenu(fileName = "Data", menuName =…

Jacob
- 135
- 2
- 12
1
vote
2 answers
I'm Having Logic Problems with New Input System
Everything up until this point works, what I want is when left & right button is clicked ability.isCharging turns true. If I get rid of the SecondaryFire.IsPressed() then it starts working, but only with the left mouse button (so I think I narrowed…

Peter Hopkins
- 33
- 7
1
vote
1 answer
Unity ScriptableObjects and String Interpolation
I am sure its possible, but I haven't figured out how. How would I go about using string interpolation for scriptableObjects? Some basic code I have for it:
public class ScriptableCardBase : ScriptableObject
{
public string cardDes;
…

Michael Surs
- 13
- 3
1
vote
3 answers
How do I call a Co-Routine in a Scriptable Object [Unity3D]
I have a coroutine which I'm trying to make a dash script from (using the unity New Input System & standard unity CharacterController) and calling the Coroutine in the scriptable object makes unity seize up.
If I were to put the controller.Move() in…

Peter Hopkins
- 33
- 7
1
vote
1 answer
Duplicating ScritableObjects with Values per Script Unity
I am making a Multiplayer Game with MLAPI. The problem is, i have a ability system so every ability get executed over an ScritableObject. The problem is, if i have for example five Players in the scene all Players are referenced to the same…

Lyksel
- 13
- 3
1
vote
1 answer
Unity: adding custom function to Scriptable Object
I want to add to my project CardSO - a scriptable object. I want to give it a name, points and for some cards a special behavior. how can I add a function to the SO field?
for most of the cards, it can be empty (or just returning 0), I hoped I can…

Netzer
- 37
- 1
- 9
1
vote
1 answer
Unity. How to store generic data for usage in ScriptableObject's code (different NPC types)
I have a bunch of different kind of NPCs in my game and of course they logically similar, they have health, they have vision, they can navigate using agent and stuff.
But each NPC type has it's own custom behavior with states, actions, decisions and…

N7D
- 192
- 3
- 12
1
vote
1 answer
How do I add a card effect to my card ScriptableObject in unity?
I have this ScriptableObject and I would like to add an effect to each card at creation; I have a script called "EffectManager" that has some methods as effects.
This is my card script
using System.Collections;
using…

Cobalixe
- 11
- 2
1
vote
1 answer
How to get a value from an array of scriptable objects in unity custom editor?
I'm trying make a custom editor and I can't get a value from a scriptable object in an array.
Here is the FightData script that contains CharacterData scriptable objects.
public class FightData : ScriptableObject {
public CharacterData []…

genper
- 25
- 6
1
vote
1 answer
ScriptableObject abstract class: access child variable
I am trying to create an item system for my game, but I can't access different variables in my Sriptable Objects that inherit from the same abstract class.
I've got an abstract class that derives from SriptableObject:
//ItemObject
public abstract…

Mario Hess
- 159
- 1
- 12
1
vote
0 answers
Can't load variables from my scriptable objects in mobile build when using Unity Visual Scripting (works in editor)
I've created a brand new test scene that only contains a prefab which has a list variable containing 3 scriptable objects (located in my project Resources folder) and a script graph containing my flow which logs a count of the list to the debug log,…

Cameron
- 11
- 2