FreshRSS

Normální zobrazení

Jsou dostupné nové články, klikněte pro obnovení stránky.
PředevčíremHlavní kanál
  • ✇Recent Questions - Game Development Stack Exchange
  • Custom inspector values in prefab mode not save to prefabFlorisdG
    I have a prefab with a custom GridModel component which has a custom editor. For some reason whenever I edit a value in Prefab Mode, the value doesn't save in the prefab asset and vice versa. How can I fix this issue? Here is my code: public class GridModel : MonoBehaviour, IGridModel { public Vector2Int dimensions; } [CustomEditor(typeof(GridModel))] public class GridModelEditor : Editor { private GridModel gridModel; void OnEnable() { gridModel = (GridModel)target;
     

Custom inspector values in prefab mode not save to prefab

I have a prefab with a custom GridModel component which has a custom editor. For some reason whenever I edit a value in Prefab Mode, the value doesn't save in the prefab asset and vice versa. How can I fix this issue?

Here is my code:

public class GridModel : MonoBehaviour, IGridModel
{
    public Vector2Int dimensions;
}
[CustomEditor(typeof(GridModel))]
public class GridModelEditor : Editor
{
    private GridModel gridModel;

    void OnEnable()
    {
        gridModel = (GridModel)target;
    }

    public override void OnInspectorGUI()
    {
        gridModel.dimensions = EditorGUILayout.Vector2IntField("Size", gridModel.dimensions);
    }
}
  • ✇Recent Questions - Game Development Stack Exchange
  • How to modify a prefab Explosion effect with your own particle sprite?ihatec
    My main goal is to create an explosion effect when I clicked the object. Therefore, I searched in Unity Assets, and found a cool framework called CartoonFX, which is really ok for me. Cartoon FX - Unity Store I am using prefab -> CFXR4 Firework 1 Cyan-Purple. However, the particles scattered around are default particles, they are provided by framework itself. I want to change them with my own particle sprites. Therefore, the explosion will look more realistic, as the object itself is really e
     

How to modify a prefab Explosion effect with your own particle sprite?

My main goal is to create an explosion effect when I clicked the object. Therefore, I searched in Unity Assets, and found a cool framework called CartoonFX, which is really ok for me. Cartoon FX - Unity Store

I am using prefab -> CFXR4 Firework 1 Cyan-Purple. However, the particles scattered around are default particles, they are provided by framework itself. I want to change them with my own particle sprites. Therefore, the explosion will look more realistic, as the object itself is really exploding.

What I tried?

  1. I opened the prefab, and its particle effect system. In there, I enabled Texture Sheet Animation, change the mode to "Sprite" from "Grid". I did not add a sprite here, because I want to add the particle sprite in the script itself, since an object could be different types, like Red, Blue etc.
  2. I tried to use Claude for that, because I could not write it myself. I am sorry but I just needed to see a working prototype, then I could fix it later. However, it only gave me unvalid code pieces (like there are no attributes of ParticleSystem that Claude claims).

I already have a particle sprite, that I load it on the script, called particleSprites, a Sprite array. However, I could not change the default particle sprite of the explosion prefab to my particle. I am not very familiar with ParticleSystem and framework itself, so I could not guess what to do at this point. I want to keep all of the other things same (how particles scatter around, how they move etc.), but only change the particle sprite element.

If you can help me, or show me a way, or a resource, I would be glad! This type of things really takes so much time, and I am really searching for it for a while. Other than that, I can understand the code part itself, its OK. Thanks in advance, love you guys.

❌
❌