I’m having a weird issue using Scriptable Objects.
I have a public reference to a Scriptable Object in my code. Sometimes I can select it and sometimes I can’t.
I was, at first able, to select an SO. I ran the game and everything worked fine. Then I exited Unity and reopened the project and I couldn’t select an SO. If I click on the SO it just doesn’t show up in the editor. Also dragging the SO doesn’t work either. I’m new to SOs so I could be doing something wrong.
Also it if I force Unity to recompile the code below (which is the code that I’m trying to plug the SO into), it will work. But it will only work until I close and reopen Unity then it won’t let me access the SO again.
This is a screenshot of me trying to select it but after selecting it, it doesn’t show up in the editor.
using System;
using UnityEngine;
using PathologicalGames;
using System.Collections;
namespace tchrisbaker {
[CreateAssetMenu(menuName = "CastSpell/ProjectileSpell")]
public class ProjectileSpell : CastSpellSO {
public ParticleBehavior particleBehaviorSOInstance;
private Transform Projectile;
public Transform prefab;
public float projectileLifeTime = 3.5f;
public override IEnumerator Cast(GameObject Target, string poolName, Transform spawnLoc, GameObject shooter)
{
Projectile = PoolManager.Pools[poolName].Spawn(prefab, spawnLoc.position, Quaternion.identity);
PoolManager.Pools[poolName].Despawn(Projectile, projectileLifeTime);
Projectile.gameObject.GetComponent<ParticleImpactScript>().shooter = shooter;
return particleBehaviorSOInstance.MoveProjectile(Projectile, Target.transform);
}
}
}