Dialogue duplication solution

Hi, after following the Nested ScriptableObject Rename Bug the solution works fine, however I’ve found another case where it breaks. It’s not a huge issue, but perhaps to note that it exists and to hopefully come up with a solution: The duplication has the same behavior as renaming, but the given solution doesn’t work for it.
I’ve played around a bit with options and found that the OnWillCreateAsset is not called on duplication, but OnWillSaveAssets is. The problem is that the function gets an array of paths, however, it is empty.

    static string[] OnWillSaveAssets(string[] paths)
    {
        Debug.Log("OnWillSaveAssets " + paths.Length);
        foreach (string path in paths)
            Debug.Log("Saving asset " + path);
        return paths;
    }

The Debug here returns OnWillSaveAssets 0 on dialogue duplication, which is sadly useless.
Do you have any other ideas on how to fix this?

Hmmm… hadn’t actually tried a duplication yet…
I found this bug to occur one out of three tries…

For the time being, I have no immediate solution. I’m tagging in @sampattuzzi to take a look at this, and I’ll try to work on it more this weekend. It seems Unity’s solution to this entire class of problems is to ignore it.

I think if you add this to OnValidate() it works:

        private void OnValidate() {
            this.name = Path.GetFileNameWithoutExtension(AssetDatabase.GetAssetPath(this));
            nodeLookup.Clear();
            foreach (DialogueNode node in GetAllNodes())
            {
                nodeLookup[node.name] = node;
            }
        }

I have come accross your courses (1) " Complete C# Unity Game Developer 2D “, (2)” Complete C# Unity Game Developer 3D" and (3)" Unreal Engine C++ Developer: Learn C++ and Make Video Games". I am highly interested in learning game development and learning is a something very interesting for me but money is a bit tight for me right now . It would be very grateful if you provide the courses for free i.e., provide the free coupon . I will give you 5 star.very exited about the courses

Please reply

Thank you very much. This does solve the problem.

Thank you for your interest in our courses!

Keep an eye out on Udemy, as our courses go on sale for very reasonable prices often. Additionally, the first sections of all of our courses are available for free on our platform if you click on the Courses tab at the top of this page. The remainder of each course is available at 80% off of our normal price.

I would be very helpful if you give me the free coupons
Of these three courses which i listed above,on udemy . I really want to enroll in the courses but money is a bit tight for me right now. Please give the free coupons.

You can try writing to support@gamedev.tv. I don’t guarantee that this will get you free courses, however.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms