public static void Import(string assetPath) { GameObject gameObject = EditorUtility.CreateGameObjectWithHideFlags("", HideFlags.HideInHierarchy); string prefabFilePath = GetPrefabPath(assetPath); GameObject prefab = PrefabUtility.CreatePrefab(prefabFilePath, gameObject, ReplacePrefabOptions.ReplaceNameBased); PSBAsset asset = ScriptableObject.CreateInstance <PSBAsset>(); asset.name = Path.GetFileNameWithoutExtension(assetPath); asset.Load(assetPath); AssetDatabase.AddObjectToAsset(asset, prefabFilePath); ForkParticleEffect particleSystem = prefab.AddComponent <ForkParticleEffect>(); particleSystem.PSBFile = asset; MeshRenderer mesh = prefab.AddComponent <MeshRenderer>(); mesh.receiveShadows = false; mesh.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off; mesh.lightProbeUsage = UnityEngine.Rendering.LightProbeUsage.Off; mesh.reflectionProbeUsage = UnityEngine.Rendering.ReflectionProbeUsage.Off; prefab.AddComponent <MeshFilter>(); GameObject.DestroyImmediate(gameObject); }
private void ForkEffectCreate() { PSBFile.Load(PSBFile.sPSBPath); RegisterSetTextureNameCB(new frkSetTextureNameCB(GetTextureCB)); // Fork SDK has been initialized, we can create our effect now if (PSBFile != null) { // Effect must pass the PSB data to dll for the effect to be created byte[] sName = System.Text.Encoding.UTF8.GetBytes(PSBFile.sPSBName); pFrkEffect = _frkParticlePluginCreateEffect(PSBFile.Data, sName, PSBFile.nDataSize); if (pFrkEffect == IntPtr.Zero) { Debug.LogError("Fork Particle: Failed to create effect."); } else { ForkParticlePlugin.Instance.AddEffect(this.gameObject); bEffectLoaded = true; bValidEffect = true; _frkParticlePluginSetEffectEnable(false, pFrkEffect); } } }