Page 1 of 1

If I'm using asmdefs, where should I place custom sequences?

Posted: Mon Jun 03, 2019 6:24 pm
by AoF
I think this is the code to find custom sequences:

Code: Select all

        private System.Type FindSequencerCommandType(string commandName)
        {
            if (m_cachedComponentTypes.ContainsKey(commandName))
            {
                return m_cachedComponentTypes[commandName];
            }
            else
            {
                var componentType = FindSequencerCommandType(commandName, "DialogueSystem");
                if (componentType == null)
                {
                    componentType = FindSequencerCommandType(commandName, "Assembly-CSharp");
                    if (componentType == null)
                    {
                        componentType = FindSequencerCommandType(commandName, "Assembly-CSharp-firstpass");
                    }
                }
                if (componentType != null)
                {
                    m_cachedComponentTypes.Add(commandName, componentType);
                }
                return componentType;
            }
        }
I think that means if I'm using asmdefs, I can't put my custom sequences in my asmdef, I have to put it in DialogueSystem or outside of all asmdefs. Since the latter could increase compile time, that leaves putting it in the DialogueSystem asmdef. But isn't that a bad idea? Won't it get overwritten or interfere with my ability to upgrade the DialogueSystem library in the future? Is there a better place to put my custom code?

Re: If I'm using asmdefs, where should I place custom sequences?

Posted: Mon Jun 03, 2019 6:29 pm
by AoF
Actually... thinking about this a little more, it doesn't make sense to put it in the DialogueSystem asmdef, because then I'd need to make that asmdef depend on my asmdef (assuming I'm calling my code in the Sequence) and vice versa. The only solution I can think of to this problem is to put my sequence outside of all asmdefs.

Spitballing here, but maybe there could be a way to tell the library which asmdefs to look in for custom code.

Re: If I'm using asmdefs, where should I place custom sequences?

Posted: Mon Jun 03, 2019 6:42 pm
by Tony Li
I've been rethinking the optimization that makes the Dialogue System only search certain assembly names. The sequencer caches sequencer command classes as it uses them, so it really doesn't do much searching. The optimization doesn't contribute much, if any, benefit to perfomance, and it comes with that annoying restriction.

Version 2.1.7 will allow custom sequencer commands to be in any assembly.

Re: If I'm using asmdefs, where should I place custom sequences?

Posted: Mon Jun 03, 2019 6:44 pm
by AoF
Cool, sounds good. In the mean time I modified that library code to do this:

Code: Select all

        private System.Type FindSequencerCommandType(string commandName)
        {
            if (m_cachedComponentTypes.ContainsKey(commandName))
            {
                return m_cachedComponentTypes[commandName];
            }
            else
            {
                var componentType = FindSequencerCommandType(commandName, "DialogueSystem");
                if (componentType == null)
                {
                    componentType = FindSequencerCommandType(commandName, "Assembly-CSharp");
                    if (componentType == null)
                    {
                        componentType = FindSequencerCommandType(commandName, "Assembly-CSharp-firstpass");
                        /** MY CODE WRITTEN HERE **/
                        if (componentType == null)
                        {
                            componentType = FindSequencerCommandType(commandName, "Scripts");
                        }
                        /** MY CODE WRITTEN HERE **/
                    }
                }
                if (componentType != null)
                {
                    m_cachedComponentTypes.Add(commandName, componentType);
                }
                return componentType;
            }
        }