Questions tagged [scriptable-object]
106 questions
4
votes
1 answer
Serializing ScriptableObject Reference (InstanceID)
Let's say I have a PlayerData ScriptableObject that holds a reference to AvatarData ScriptableObject like so:
public class PlayerData : ScriptableObject
{
public AvatarData avatar;
}
During gameplay player can change the avatar to another one.…

Dave
- 2,684
- 2
- 21
- 38
3
votes
1 answer
How do I go about saving multiple modified prefabs instantiated from the same scriptable object C#
Work with me now, I'm a confused lost little child at this point.
Intro
I have an inventory that allows me to place items into a gear slot, instantiating that item in my players hand/ on body. For example, I have a simple rifle, I put it in my gear…

Brandon Rose
- 31
- 1
3
votes
1 answer
Deserialize multiple unrelated ScriptableObjects from one save file
I want to save multiple, unrelated ScriptableObjects objects to one save file. That way, I can save / load data for anything I might want to keep track of. IE. Doors Unlocked, Inventory, High Scores, Treasure Chests found, etc.. This way I can…

user-44651
- 3,924
- 6
- 41
- 87
3
votes
5 answers
How to fix 'The type or namespace name could not be found ' error in unity?
I am setting up a new scriptable object in Unity 5 and when I am trying to set up a reference to it an error shows up :'The type or namespace name 'ES' could not be found (are you missing a using directive or an assembly reference?'
the scriptable…

Mwiak
- 31
- 1
- 1
- 2
2
votes
1 answer
Using scriptable objects for characters information
hey everyone
I asked this question in unity answers but I didn't get any answers.
I'm new to programming and I have a question about scriptable objects. I'm making a strategy management game and I have characters in the game with unique information…

Mehrad
- 23
- 6
2
votes
1 answer
Serializable object is looking weird in the inspector
So I have this small class called StoryTrigger:
namespace VisualNovelScripting
{
[System.Serializable]
public class StoryTrigger
{
[SerializeField] public string triggerName;
public bool value;
public…

Gustavo HK
- 85
- 9
2
votes
3 answers
Unity ScriptableObjects - Read-only fields
Say I have a ScriptableObject Item:
public class Item : ScriptableObject
{
public new string name;
public string description;
public Sprite sprite;
}
The only issue is that the fields can be modified:
Item item = new…

Isaac Thompson
- 75
- 1
- 1
- 7
2
votes
1 answer
How do I find all Scriptable Objects in a folder and then load a variable from one?
I have a folder in my unity project under "Resources/ScriptableObjects/Skins". I need to get all the objects in the folder, generate a random number for the index, then assign the sprite to an existing game object that the script is attached to. The…

ItsSgtMarv
- 105
- 1
- 11
2
votes
1 answer
unity Scriptable object not working in bulid
hi I am new to unity and C# and I am making my first game. In it I have a Scriptable object named "sss".It contains values like coins,speed,jump power. It works fine in the editor but after I build it it wont work.what I mean by it wont work is…

Powplowdevs
- 55
- 1
- 2
- 8
2
votes
1 answer
Unity scriptable objects references lost using GIT
I'm currently working on a project where we use scritpable objects to store all configs on the game. The problem comes using git since sometimes we lose references stored on those SO.
For example I have a Config called A with a GameObject variable.…

Josef21296
- 21
- 4
2
votes
1 answer
How to save a ScriptableObject at runtime after changing its values
I have a Problem with Using ScriptableObjects as a saving object within of my Unity Application. When I try to write values into them it all works quite fine, but if I want to close the application and Load the values of the ScriptableObject those…

Assasin Bot
- 136
- 1
- 1
- 11
2
votes
1 answer
Global Scriptable Object
Suppose I have this ScriptableObject to represent a list of cards:
using UnityEngine;
using System.Collections;
[CreateAssetMenu(fileName = "CardList", menuName = "Inventory/List", order = 1)]
public class CardList : ScriptableObject {
public…

Daniel
- 7,357
- 7
- 32
- 84
1
vote
1 answer
Scriptable Object in Unity
I'm a quite confused about Scriptable Objects. For example, can I use 'new' when I create a Scriptable Object? If I can't use 'new', how can I use it, and how do the code examples I provided below work?
This is my Player script that detects when the…

erdem.61
- 27
- 4
1
vote
0 answers
Serializing References to ScriptableObjects
Currently I'm using ScriptableObjects as a template for things like character's faction, weapons, etc.
Using faction as an example the FactionSO is a container for CharacterStats class for a character like move speed/ damage multipliers and so on.…

saranw71
- 11
- 2
1
vote
1 answer
how to correctly create a variable that will accept different classes
I have a main code that stores all information about a player:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
[CreateAssetMenu(fileName = "CarData", menuName = "Data/Car/CarData")]
public class…

Pavel Sheludko
- 13
- 3